help with column tables = SOLVED

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
smash
Posts: 99
Joined: Tue Aug 19, 2008 5:18 am

help with column tables = SOLVED

Post by smash » Thu Jul 16, 2009 12:49 pm

i am stuck on trying to get numbers to automatically fill up a column.
i have a button with the below script
on mouseUp
set numberformat to "0.00"
put value (field "StartTime" + "0.08") into field "Entries"
end mouseUp
a field inwhich i put the first number in and a table with columns.

i am trying to press the button and start a sequence of times to run down one column automatically, but can not find a script to do this.
also is there a way to link other columns with the number column ?

say the same car is entered in two races that have the same "start time" but need them to go into each "race" at different times.
CAN THIS BE DONE???
please say it can.
thank you
tanya
Last edited by smash on Fri Jul 17, 2009 11:29 pm, edited 1 time in total.

smash
Posts: 99
Joined: Tue Aug 19, 2008 5:18 am

Post by smash » Fri Jul 17, 2009 2:28 am

anybody ?????
please !!!!!!!!!!!

SparkOut
Posts: 2944
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Fri Jul 17, 2009 9:06 am

You might want something like this, where you could set a start time and a "last entry time" field, then have an 8 minute interval between each. If you use the time manipulation tools in Rev, then you will get sensible time-based results, as starting from 11:00 you would obviously end up with 11:64 after adding just 8 entries.

Code: Select all

on mouseUp
   local tTime, tLastEntry
   put empty into field "Entries"
   put field "StartTime" into tTime
   put field "LastEntry" into tLastEntry
   convert tTime to dateItems
   convert tLastEntry to dateItems
   repeat until tTime > tLastEntry
      convert tTime to short time
      put tTime & cr after field "Entries"
      convert tTime to dateItems
      add 8 to item 5 of tTime
   end repeat
end mouseUp
This would need tweaking to allow for morning/afternoon sessions with a break between, for instance, as well as error trapping that the start and last entry times have been input correctly. (Use 24 hr notation, or say 5:00 PM for example to have the time of day recorded properly.)

smash
Posts: 99
Joined: Tue Aug 19, 2008 5:18 am

Post by smash » Fri Jul 17, 2009 9:50 am

hello dear friend sparkie,
thank you for replying as this really has me stumped. (not hard to do as i am sure you know) :oops:
ok, i have tried the code, and
*put field "LastEntry" into TLastEntry*
comes up as an error
could you explain what "LastEntry" is to signify ??
thanks for the code, as it i can sort of understand it LOL (sort of)
also cr, what is that, as i have not seen that refered to anywhere
thank you so much for replying sparkie

SparkOut
Posts: 2944
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Fri Jul 17, 2009 11:03 am

Well I guess I didn't say as much, but you already have a field "StartTime" and you will need to add another field "LastEntry" on the card, so that you can have a range of times that you want to fill with possible entry start times. Otherwise you could put a counter in the loop for example, to repeat for a particular number of entries, but although I didn't say as much above, this method at least allows for a flexible start and stop time.
You can put "11:00 AM" in the "StartTime" field and "5:00 PM" in the "LastEntry" field and have the "Entries" field filled with times at 8 minute intervals between. You will need to put the times in a format that Rev can recognise as times in a 24 hour notation, either by specifying AM or PM, as shown, or by putting "11:00" and "17:00" respectively - otherwise you might get entries through the whole day and through the night too, up to 05:00 AM the next day.

smash
Posts: 99
Joined: Tue Aug 19, 2008 5:18 am

Post by smash » Fri Jul 17, 2009 12:02 pm

hi sparkie, i could not get that script to work, as all it would do was clear all entrants in the table.
it also, did not add any time to any column.
going to drown my sorrows in alcohol :wink:
back to the dictionary for me i go LOL

SparkOut
Posts: 2944
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Fri Jul 17, 2009 5:28 pm

Hi smash,
Check your email. Try not to see double!
There's a stack attached which should be a little clearer than above, and also work better with better time comparisons in seconds. Take a look and let me know if it helps any more.

smash
Posts: 99
Joined: Tue Aug 19, 2008 5:18 am

Post by smash » Fri Jul 17, 2009 11:30 pm

THANK YOU SPARKIE
your email cleared up my problem completely
thank you
tanya

Post Reply