Converting field into table & vice versa

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
david_ff
Posts: 12
Joined: Mon Jan 29, 2007 1:15 am

Converting field into table & vice versa

Post by david_ff » Sat Jan 07, 2012 4:49 am

What would be a script for turning a field into a table, or vice versa. This is easily done in the Object Inspector, but I would like to be able to do this in a script.
Thanks,
David

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Converting field into table & vice versa

Post by jmburnod » Sat Jan 07, 2012 12:34 pm

Hi David,

You cane use the replace command like this:

Code: Select all

function FromCommaToTab pText -- pText contains lines with items, itemdel = ","
   replace "," with tab in pText
    return pText
end FromCommaToTab

function FromTabToComma pText
   replace tab with ","  in pText
   return pText
end FromTabToComma
Best regards

Jean-Marc
https://alternatic.ch

david_ff
Posts: 12
Joined: Mon Jan 29, 2007 1:15 am

Re: Converting field into table & vice versa

Post by david_ff » Sat Jan 07, 2012 7:57 pm

Thanks for the reply.
I'm running Revolution 2.1.2, and I don't see that function in the documentation, nor does it work. Other ideas?

Best
David

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Converting field into table & vice versa

Post by jmburnod » Sat Jan 07, 2012 8:33 pm

Hi David,
I'm running Revolution 2.1.2, and I don't see that function in the documentation
I don't remember if the "replace" command exist in Rev 2.12 but i'am sur there is not a FromTabToComma finction. I write it :D

Are you sur there is not a "replace" command in Rev 2.12
, nor does it work
How do you try to use it ?

Best regards

Jean-Marc
https://alternatic.ch

david_ff
Posts: 12
Joined: Mon Jan 29, 2007 1:15 am

Re: Converting field into table & vice versa

Post by david_ff » Mon Jan 09, 2012 6:08 am

Jean-Marc,

There is a replace command (and a replacetext command) in Revolution 2.1.2, but I don't see how I can use it to convert a table to a normal field or vice-versa.

David

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Converting field into table & vice versa

Post by jmburnod » Mon Jan 09, 2012 9:54 am

Hi David,

I put a simple stack in attachment

Best regards

Jean-Marc
Attachments
ConvertFldToTable.livecode.zip
(1.35 KiB) Downloaded 265 times
https://alternatic.ch

david_ff
Posts: 12
Joined: Mon Jan 29, 2007 1:15 am

Re: Converting field into table & vice versa

Post by david_ff » Fri Jan 13, 2012 11:29 pm

Thank you, Jean-Marc. This should solve the problem.
Best,
David

Post Reply