How doI get quoted field names?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jpottsx1
Posts: 46
Joined: Thu Jun 04, 2009 12:46 am
Contact:

How doI get quoted field names?

Post by jpottsx1 » Sun Sep 18, 2011 2:21 am

I need to generate put statement for a large number of database fields. I want to loop through creating the names of the fields and Data fields as follows;

Code: Select all

put revDatabaseColumnNamed(sRecordSetID,"Depress_Field_1") into field "Depress_Field_1"
I am having trouble with building the strings in the loop due to the existence Quotes and the need to create quoted statements.

I have tried:

Code: Select all

repeat with i = 1 to 10
put ",put revDatabaseColumnNamed(sRecordSetID,"&",UserField"& i&")into field"& ",UserField"& i
end repeat 
I cannot seem to get the generation of the field names quoted so that I can actually assign the fields and names properly
Jeff G potts

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: How doI get quoted field names?

Post by Dixie » Sun Sep 18, 2011 4:54 am

Jeff,
I need to generate put statement for a large number of database fields. I want to loop through creating the names of the fields and Data fields as follows;

Code: Select all

put revDatabaseColumnNamed(sRecordSetID,"Depress_Field_1") into field "Depress_Field_1"
How about...

Code: Select all

put "put revDatabaseColumnNamed(sRecordSetID," & quote & "Depress_Field_1" & quote & ") into field " &  quote & "Depress_Field_1" & quote into myVar
be well,

Dixie

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: How doI get quoted field names?

Post by BvG » Sun Sep 18, 2011 5:13 am

within sql calls you can also use single quotes (it's kinda hard to see ;) ):
repeat with i = 1 to 10
put revDatabaseColumnNamed(sRecordSetID,'" & UserField & i &"') into field ("UserField"& i)
end repeat
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

Post Reply