Page 1 of 1

How doI get quoted field names?

Posted: Sun Sep 18, 2011 2:21 am
by jpottsx1
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

Re: How doI get quoted field names?

Posted: Sun Sep 18, 2011 4:54 am
by Dixie
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

Re: How doI get quoted field names?

Posted: Sun Sep 18, 2011 5:13 am
by BvG
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