I am using DBLib to return a set of values from an sqlite database in a specific order but I am having a problem creating a combobox which displays the correct order. If I debug and step through the code, the array when returned from the query is correctly ordered. When the following piece of code is executed, the resulting combobox is not in the correct order:
dbOrderBy "supplierName"
put dbGet("suppliers") into allSuppArray
put CR into sComboBox
repeat for each line sKey in (the keys of allSuppArray)
put allSuppArray[sKey]["supplierName"] & CR after sComboBox
end repeat
Can anyone shed some knowledge please?
Thanks
DBLib and using OrderBy
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: DBLib and using OrderBy
Good day,
Anyone able to tell me why the foreach statement below does not start on the first key in (the keys of myArray)? For some reason, it begins at a random number, normally 8 so my drop down combo box is never in the order that I want it.
Please help. I am stuck.
Cheers
N
Anyone able to tell me why the foreach statement below does not start on the first key in (the keys of myArray)? For some reason, it begins at a random number, normally 8 so my drop down combo box is never in the order that I want it.
Please help. I am stuck.
Cheers
N
Re: DBLib and using OrderBy
Hi nicoloose,
DBLib is not a liveCode product. Go to where you downloaded the product from, there is a forum there for your questions.
Simon
DBLib is not a liveCode product. Go to where you downloaded the product from, there is a forum there for your questions.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: DBLib and using OrderBy
Hi Simon,
Thanks for the reply. This is not actually a DBLib issue I have discovered. I have recreated this by constructing a simple sql statement and returning an array which as I mentioned, is in the order that I want. As soon as i perform a foreach statement on the array, this is when the order becomes jumbled up. In the debugger, "sKey" in the foreach statement never starts at "1" for some reason?
repeat for each line sKey in (the keys of allSuppArray)
put allSuppArray[sKey]["supplierName"] & CR after sComboBox
end repeat
Regards
Nic
Thanks for the reply. This is not actually a DBLib issue I have discovered. I have recreated this by constructing a simple sql statement and returning an array which as I mentioned, is in the order that I want. As soon as i perform a foreach statement on the array, this is when the order becomes jumbled up. In the debugger, "sKey" in the foreach statement never starts at "1" for some reason?
repeat for each line sKey in (the keys of allSuppArray)
put allSuppArray[sKey]["supplierName"] & CR after sComboBox
end repeat
Regards
Nic
Re: DBLib and using OrderBy
Hi Nic,
Not sure, but is this in:
http://lessons.runrev.com/s/lessons/m/4 ... t-an-array
in which split and element are used?
Simon
Not sure, but is this in:
http://lessons.runrev.com/s/lessons/m/4 ... t-an-array
in which split and element are used?
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!