Is it possible to have a dynamic variable that is dependent on the nth record it is in?
I have a Gallery that shows records, each record has a different "Added Date and time".
I want to create a countdown against each record which displays the minutes and seconds left until 15 minutes after is was added.
i.e record 1 was added at 12:00 , current time is 12:05 , countdown would show 00:10:00 (Ten minutes left)
To generate the values needed to create the countdowns I have a timer with the duration of 1000 ms (1 sec) that repeats and does the below ontimerend (it works out the difference between when the record was added and now in ms)
This creates the variable "countdowns" with both countdown1 and countdown2 retrieving their values from selected (1st & 2nd) records, achieved by using the "First" and a "Last(FirstN" functions to select the correct record. This will be expanded for the 3rd 4th etc when I work out the below issue.
So this works well , however i'm now not sure how to call the variables in the respective record.
What I want to say in the label text property in each record (that will be the countdown) is "If i'm the first record in the gallery my text property should be Countdown1" and "If i'm the Second record in the gallery my text property should be Countdown2".
So I need to call the correct variable dependant on which record "I" am.
I really hope this makes sense.
Alternatively if you can think of a different way of achieving this requirement please let me know.
To be honest this is were a foreach function would come in handy.
Please consider take use of AddColumns() function to create a collection with a CountDown column added to the original data source, better with the Primary Key Renamed to another value, for example, rename the ID field to CID.