Array Looping to Insert into Database
Graham Pearson
gspearson at gmail.com
Tue May 14 17:30:41 EDT 2013
Now my next array question is a bit different and trying to use the
knowledge from the array listed below to solve for this array which has
not worked as of yet (But still trying as I write this).
New Array:
gAvailableMarketReceiveTowerDataArray
ReceiveTowers
Market[10]
@attributes
ID WHR769
Tower[1]
@attributes
ID KY-000001
Address 951 Dixie Highway
City Louisville
State KY
County
TowerLatitude 38.2425270
TowerLongitude -85.7843640
Tower[2]
@attributes
ID KY-000002
Address 245 West Dixie Highway
City Elizabethtown
State KY
County
TowerLatitude 37.65959
TowerLongitude -85.8621
In using the previous knowledge, I tried to use
put the keys of gAvailableMarketReceiveTowerDataArray[ReceiveTowers]
into tKeys
repeat for each line L in tKeys
answer info
gAvailableMarketReceiveTowerDataArray[ReceiveTowers][L]["ID"] with "OK"
end repeat
In running this, I get a blank answer box with the info icon and OK
button. What I am trying to do is store the XML Data into SQLite so it
can be used offline to display information regarding these wifi hotspot
locations.
On 5/8/2013 12:01 PM, Peter Haworth wrote:
> Can't help with the XML stuff but it doesn't seem to difficult to use the
> array.
>
> put the keys of gAvailableMarketDataArray[AvailableMarkets] into tKeys
> sort tKeys -- if you care
> repeat for each line L in tKeys
> <do stuff with gAvailableMarketDataArray[AvailableMarkets] [L]>
> end repeat
>
> If you're inserting/updating stuff into an sqlite database, don;t forget to
> issue a BEGIN before the repeat loop, a COMMIT after the repeat loop, and
> ROLLBACK if any errors occur within the repeat loop. Everything will work
> much faster that way.
>
> Pete
> lcSQL Software <http://www.lcsql.com>
>
>
> On Wed, May 8, 2013 at 6:38 AM, Graham Pearson <gspearson at gmail.com> wrote:
>
>> Array Experts
>>
>> In my application that I am converting from Adobe Air, I have come to a
>> section where Google has let me down. I have converted my XML File to an
>> Array and can see it within the Debugger and parts of the array is
>> listed below.
>>
>> gAvailableMarketDataArray
>> AvailableMarkets
>> Market[1]
>> BTALatitude 27-29-40.1-N
>> BTALongitude 81-24-59.3-W
>> CallSign WNC905
>> City Sebring
>> State FL
>> @attributes
>> ID 1
>> Market[2] etc.
>>
>>
>> The application pulls the XML File from a Web Service that generates it
>> on the fly. The application on first run checks to make sure the
>> database exists and records are within it. At this point no records are
>> retrieved from the database so I am struggling with how to take this
>> array and insert each record of the array into the database.
>>
>>
>> Or is their a command/function that I can use after
>>
>> put revCreateXMLTree(gClientAvailableMarketsXMLData, false, true, false)
>> into tAvailableMarketData
>>
>> that will give me just the Market part of the XML data so then I can
>> create the array which will simply list the Market[1] directly under the
>> gAvailableMarketDataArray which will make it easier to insert the array
>> into the sqlite database.
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
More information about the use-livecode
mailing list