Anomoly when storing empty values into SQLite integer fields
Mark Smith
Mark_Smith at cpe.umanitoba.ca
Thu Feb 23 14:48:26 EST 2012
Peter Haworth-2 wrote
>
> You could try changing the line in my sample code "put field
> myField into myArray[x]" to "put the text of field myField into
> myArray[x]".
> Pete
>
Yipppeee! That worked. The following code copies all of a forms values into
an sql database... no manual coding required. Truly awesome... thanks to
everyone who contributed suggestions along the way.
put "UPDATE prenatal SET " into tCmd
put 1 into x
repeat with y = 1 to the number of fields of this card
if the short name of field y <> "Label Field" and toupper(the cStoreMe
of field y) <> "N" then
put the short name of field y into fieldname
put fieldname & "=:" & x & comma after tCmd
put the text of field fieldname into myArray[x] -- put the field
VALUE into myarray
add 1 to x
end if
end repeat
put space into char -1 of tCmd
put "where EventID=" & tEventID after tCmd
revExecuteSQL gConnectID, tCmd, "myArray"
You can use a custom parameter called cStoreMe with a value of N to indicate
you don't want a field copied to the database (and you don't have to define
it for the fields you do want copied). I have 20 entry forms with up to 100
values per form to code, so this little snippet is going to save a TON of
time.
I've really appreciated the discussion.
-- Mark
--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/Anomoly-when-storing-empty-values-into-SQLite-integer-fields-tp4408942p4415011.html
Sent from the Revolution - User mailing list archive at Nabble.com.
More information about the use-livecode
mailing list