Strange behaviour using "Convert"
Posted: Tue Jan 01, 2013 11:01 am
I have a command that loops through an array. This array builds a string of values that will later be used to build a SQL insert. The problem I'm having is on the Convert potion of the code (see images). You'll notice that the first block performs the calculation while the second block does not.
I've included the whole command just for interest. Maybe there's something in there that'll give you a clue of what could be wrong.
Has anyone come across a problem like this and if so what did you do to resolve this?
Thx
I've included the whole command just for interest. Maybe there's something in there that'll give you a clue of what could be wrong.
Code: Select all
command buildFieldNameAndValuesVariable
global PLNListingDetailArray, gPLNColumnNames, gPLNFieldValues
local tArrayElement
local tValue, tCalculatedSeconds, tEnteredDate
local tItemName
repeat for each element tArrayElement in PLNListingDetailArray
put gPLNColumnNames & tArrayElement[3] & "," into gPLNColumnNames
put empty into tValue
switch tArrayElement[5]
case "OptionMenu" -- OptionMenu datatype
if tArrayElement[1] = "PropertyTypeOptionMenu" then
put the label of button "PropertyTypeOptionMenu" into tItemName
put char 1 of tItemName into tValue
break
end if
if tArrayElement[1] = "PropertySubtypeOptionMenu" then
put the label of button "PropertySubtypeOptionMenu" into tItemName
put char 1 of tItemName into tValue
break
end if
if tArrayElement[1] = "AreaOptionMenu" then
put the label of button "AreaOptionMenu" into tItemName
put char 1 of tItemName into tValue
break
end if
case "CheckBox" -- CheckBox datatype
if GetAction() = "Add" then
put 0 into tValue
end if
if tArrayElement[1] = "NoOpenHourCheck" then
if the hilite of button "NoOpenHourCheck" is true then
put 1 into tValue
end if
break
end if
if tArrayElement[1] = "IsRentalCheck" then
if the hilite of button "IsRentalCheck" is true then
put 1 into tValue
end if
break
end if
if tArrayElement[1] = "DontContactOwnerCheck" then
if the hilite of button "DontContactOwnerCheck" is true then
put 1 into tValue
end if
break
end if
case "DateEntryField"
put empty into tEnteredDate
if tArrayElement[1] = "ListDateField" then
put field "ListDateField" into tEnteredDate
--convert tEnteredDate from short date to seconds
convert tEnteredDate to seconds
put tEnteredDate into tValue
break
end if
if tArrayelement[1] = "ListingExpiryDateField" then
put field "ListingExpiryDateField" into tEnteredDate
--convert tEnteredDate from short date to seconds
convert tEnteredDate to seconds
put tEnteredDate into tValue
break
end if
if tArrayElement[1] = "OpenHourDateField" then
put field "OpenHourDateField" into tEnteredDate
convert tEnteredDate from short date to seconds
put tEnteredDate into tValue
break
end if
end switch
put gPLNFieldValues & tValue & "," into gPLNFieldValues
end repeat
delete last character of gPLNColumnNames
end buildFieldNameAndValuesVariable
Thx