Strange behaviour using the "convert" command

Peter Haworth pete at lcsql.com
Tue Jan 1 12:15:16 EST 2013


Hi Nigel,
Don;t see anything obvious but a couple of questions.

Your loop is always looking at tArrayElement[1] - should the "1" be
incrementing each time through the loop?

Also, when you say the code does "nothing", not sure just what you mean.
 Does the code not execute (checked with debug breakpoints), or does it
execute but you end up with empty in tValue?


Is there perhaps another case statement earlier than the one in your email
that could be firing on the second and subsequent times through your loop?

Pete
lcSQL Software <http://www.lcsql.com>


On Tue, Jan 1, 2013 at 3:15 AM, Nigel Soden <nigels at amglighthouse.co.za>wrote:

> 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.
>
>
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list