Page 1 of 1
tab and return separated data to array
Posted: Sat Aug 08, 2015 7:34 am
by Pistris
Hi there, am using the following line to get a whole table into a variable
put revDataFromQuery(tab ,cr , gConnectionID, tSQL) into tData
the data in the table is the following
1 john smith
2 ana smith
3 carol smith
if i split tdata by column, i can retrieve the values by using tdata[1], tdata[2] and tdata[3] (all working fine)
if i split by return ( split tData by return ) i can also retrieve the whole rows (all working fine)
but if i use ( split tData by return and tab ) how can i retrieve the individual data
lets say i want to retrieve the lastname of the second row.
edd.
also if someone has a good tutorial or guide on arrays
Re: tab and return separated data to array
Posted: Sat Aug 08, 2015 8:25 am
by bn
Hi Pistris,
try
Code: Select all
on mouseUp
put field 1 into tData
split tData by return and tab
put tData[2] into tSecondRecord
put the itemDelimiter into tOldDelim -- store current itemDelimiter
set the itemDelimiter to tab
put item 2 of tSecondRecord into tLastName
set the itemDelimiter to tOldDelim -- restore old itemDelimiter
put tLastName -- shows it in the message box
end mouseUp
This way your record number will be the index number of the array and the content of each record will be the content of that index number
Now you have the content of your array as tab delimited data. To access the content you change the itemDelimiter to tab and you get to the data you want.
Storing the current itemDelimiter before changing and restoring after is not necessary for this to work but in long scripts where you change the itemDelimiter repeatedly it avoids confusion.
The itemDelimiter is reset automatically to comma (the default) when your script ends.
also if someone has a good tutorial or guide on arrays
I read the user guide and the dictionary, understood only half of this and think the best guide for me was the debugger.
If you use a small sample of your dataset and do your split command on it and set a breakpoint after it the debugger will show you what is in your array variable.
So actually once you have your data in the array you use normal chunking (get item x of y) to access individual pieces of your data.
I hope this explains it a bit, but seeing that you are familiar with structured data from a database this should get you going.
Please ask if this is not clear
Kind regards
Bernd
Re: tab and return separated data to array
Posted: Sat Aug 08, 2015 8:44 am
by Pistris
Perfectly clear
thank you for your super fast response
am actually putting the finishing touches on my app
and now am struggling with mac
am a pc guy and i bought a mac and dont know where to start
am looking on youtube videos relating to installing and setting up livecode but i cant find any
i think am gonna have to go to school for what should be the easiest part of all this.
Edd.
Re: tab and return separated data to array
Posted: Sat Aug 08, 2015 8:58 am
by bn
Hi Edd,
once you have downloaded Livecode it will end up in your download folder. You can acess it in the doc. Double-click on the downloaded LC. It will open the installer automatically and this will mount a "diskImage", a temporary volume. This will open automatically and you double-click on the icci. The and you will be asked if you want to install the program that you downloaded from the internet. OK all the questions. When the Livecode Installer starts it asks where you want to put Livecode. Accept the default "for all". This puts it into the Application Folder. Once you have Livecode installed and started at the end of the installation process (if commercial there is a registration) you are done.
You find Livecode from now on in the the Application folder. What I do is when Livecode is running you have its icon in the dock. If you right click on the icon in the dock you have the option to keep the icon in the dock. That way you can start Livecode from the dock conveniently.
After installation the disk image will stay mounted on your desktop, to get rid of it drag it to the trash once you are done.
If you want to get rid of an appliction on a Mac just drag the application from the Application Folder to the trash.
Again, ask if this is not clear.
Kind regards
Bernd
Re: tab and return separated data to array
Posted: Sun Aug 09, 2015 3:24 am
by Pistris
Thank you so much
i followed your instructions
i figured how to install xcode too
what am missing is the certificates and also the simulator when it opens stays there forever, it never shows my app
I have LC 7.0.3, decided to download this version because is a stable release
what version of xcode should i install that is compatible with 7.0.3
i downloaded a beta version from the app store and i read some post here on the forum saying that its not compatible
thank you very much for all your help.
Re: tab and return separated data to array
Posted: Sun Aug 09, 2015 12:31 pm
by bn
Hi Edd,
sorry I do not know which XCODE works with which Livecode. As a rule of thumb don't download beta versions of XCODE since Livecode only supports final versions.
Maybe someone in the know can chime in.
As far as certificates is concerned: a huge complicated thing (at least for me) designed in Cupertino.
Read the Developer instructions at Apple.
Kind regards
Bernd
Re: tab and return separated data to array
Posted: Sun Aug 09, 2015 2:56 pm
by bn
Hi Edd,
found out how to find out:
in Livecode go to preferences, choose "Mobile Support". Then click on button "add entry" and point the dialog to your version of XCODE.
if it is the wrong version then it will tell you which version of the
iOS developer kit it supports

- LC 7.0.6.png (15.33 KiB) Viewed 4689 times
This is from LC 7.0.6, the latest stable release.
But the version is not the XCODE version but the iOS Kit version, you would have to find the XCODE version which supports as the highest iOS kit 8.3.
Kind regards
Bernd
Edit: 7.0.3 supports XCOD 6.1
Re: tab and return separated data to array
Posted: Fri Aug 14, 2015 5:45 am
by Pistris
All working now
Thank you very much