check whether at the least item possible
Posted: Fri Sep 28, 2012 8:31 am
Hi,
I am using a repeat loop to iterate over a list of field names and then using an array to set up an SQL statement.
It looks something like this:
What I would like to do is to avoid coding the deleting of the last comma after I've been through the loop. Why? Just lazy I guess 
So, is it possible to do something like?:
This doesn't work but I somehow think it should. But, wishing doesn't make it so!
Anyone know of the/a way to do this?
cheers
I am using a repeat loop to iterate over a list of field names and then using an array to set up an SQL statement.
It looks something like this:
Code: Select all
repeat for each item columnName in tableColumns
put & "'" & aDBColumns[columnName] & "'" & ","after theColumnValues
end repeat

So, is it possible to do something like?:
Code: Select all
repeat for each item columnName in tableColumns
if columnName is last item then
put "'" & aDBColumns[columnName] & "'" after theColumnValues
else
put "'" & aDBColumns[columnName] & "'" & "," after theColumnValues
end if
end repeat

Anyone know of the/a way to do this?
cheers