Strange behaviour using the "convert" command

Nigel Soden nigels at amglighthouse.co.za
Tue Jan 1 06:15:07 EST 2013


Greeting to all in this the 1st of Jan 2013

And yes I'm working.

I have an array that is being looped though in which to build a SQL string that'll contain data that will be used in a SQL INSERT.

The loop works great until I get to use the "convert" command.  I have to convert the date into seconds as this is what is been used in the main database sitting somewhere else as this application is to be used on an iPad using SQLITE.  I have various option in which to convert the date to seconds. The one I choice for this is when building the string up that'll contain the data is at the point when building this string.

The problem is as follows. The first time the code block containing a date it converts the date into seconds successfully. The very next iteration of the loop is also a date and that portion of the code just does "nothing". No conversion occurs, the very next iteration of  the loop is also a date format and that too does not work neither.  

The code for the conversion is as follows.


case "DateEntryField"
            
            put empty into tEnteredDate
           
            if tArrayElement[1] = "ListDateField" then  
               put field "ListDateField" into tEnteredDate
               convert tEnteredDate to seconds
               put tEnteredDate into tValue
               break
            end if
            
            if tArrayelement[1] = "ListingExpiryDateField" then 
               put field "ListingExpiryDateField" into tEnteredDate
               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
            

as you will notice the only difference to the three blocks of code is the field name were the date is being held. For the rest of the block it is identical.     
I've tried the different syntax's but to no avail. 

Any suggestions.      







More information about the use-livecode mailing list