O oscarsarrio Member Licensed User Longtime User Feb 12, 2015 #1 Hi, In B4A had this code to clean arrays: Dim estados(300) As Int Dim nombres(300) As String For z=0 To 300 estados(z)="0" nombres(z)="" Next But b4i not work gives me error. I also happens in this simple operation: For Each records() As Object In result.Rows Dim yo As Int = records(0) estados(yo)=estados(yo)+1 Log(yo) Next The arrays do not work like ?? ... A greeting
Hi, In B4A had this code to clean arrays: Dim estados(300) As Int Dim nombres(300) As String For z=0 To 300 estados(z)="0" nombres(z)="" Next But b4i not work gives me error. I also happens in this simple operation: For Each records() As Object In result.Rows Dim yo As Int = records(0) estados(yo)=estados(yo)+1 Log(yo) Next The arrays do not work like ?? ... A greeting
Erel B4X founder Staff member Licensed User Longtime User Feb 12, 2015 #2 Please use [code]code here...[/code] tags when posting code. Which error do you get? Upvote 0
O oscarsarrio Member Licensed User Longtime User Feb 12, 2015 #3 Ok Erel: Really code is: Code: Copy Dim estados(300) As Int Dim nombres(300) As String For z=0 To 300 estados(z)=0 nombres(z)="" Next Error: Parsing code. 0.03 Compiling code. Error Error compiling program. Error description: Array expected. Occurred on line: 138 estados(z)=0 Word: ( Thanks Upvote 0
Ok Erel: Really code is: Code: Copy Dim estados(300) As Int Dim nombres(300) As String For z=0 To 300 estados(z)=0 nombres(z)="" Next Error: Parsing code. 0.03 Compiling code. Error Error compiling program. Error description: Array expected. Occurred on line: 138 estados(z)=0 Word: ( Thanks
Erel B4X founder Staff member Licensed User Longtime User Feb 12, 2015 #4 I don't get any error. Which version of B4i are you using? Maybe there is a sub with the same name? Note that you don't need to clear the array as it will be in the exact same state when you create it (all zeros or all empty strings). Upvote 0
I don't get any error. Which version of B4i are you using? Maybe there is a sub with the same name? Note that you don't need to clear the array as it will be in the exact same state when you create it (all zeros or all empty strings).
klaus Expert Licensed User Longtime User Feb 12, 2015 #5 Not the same issue, but this code will also raise an error in B4A when z = 300 ! Code: Copy Dim estados(300) As Int Dim nombres(300) As String For z=0 To 300 estados(z)=0 nombres(z)="" Next This will work ! For z=0 To 299 Upvote 0
Not the same issue, but this code will also raise an error in B4A when z = 300 ! Code: Copy Dim estados(300) As Int Dim nombres(300) As String For z=0 To 300 estados(z)=0 nombres(z)="" Next This will work ! For z=0 To 299
O oscarsarrio Member Licensed User Longtime User Feb 12, 2015 #6 Not a sub with the same name as if I put a comment in error everything works right. The problem is that it happens in any operations with arrays. Also in: Code: Copy If Job.tag = "select_bicis" Then Dim result As DBResult = reqManager.HandleJob(Job) For Each records() As Object In result.Rows Dim yo10 As Int = records(0) estados(yo10)=estados(yo10)+1 Log(yo10) Next End If Error: Parsing code. 0.03 Compiling code. Error Error compiling program. Error description: Array expected. Occurred on line: 183 estados(yo10)=estados(yo10)+1 Word: ( The variables defined in the Process_Globals as: Code: Copy 'SQL Dim estados(300) As Int Dim nombres(300) As String I Use the version 1.80 of b4i Upvote 0
Not a sub with the same name as if I put a comment in error everything works right. The problem is that it happens in any operations with arrays. Also in: Code: Copy If Job.tag = "select_bicis" Then Dim result As DBResult = reqManager.HandleJob(Job) For Each records() As Object In result.Rows Dim yo10 As Int = records(0) estados(yo10)=estados(yo10)+1 Log(yo10) Next End If Error: Parsing code. 0.03 Compiling code. Error Error compiling program. Error description: Array expected. Occurred on line: 183 estados(yo10)=estados(yo10)+1 Word: ( The variables defined in the Process_Globals as: Code: Copy 'SQL Dim estados(300) As Int Dim nombres(300) As String I Use the version 1.80 of b4i
klaus Expert Licensed User Longtime User Feb 12, 2015 #7 Unfortunately you don't give enough information. You should post a small project showing the problem. Upvote 0
Unfortunately you don't give enough information. You should post a small project showing the problem.
O oscarsarrio Member Licensed User Longtime User Feb 12, 2015 #8 Sorry same name array than sub .. All working thx Upvote 0