format data before setting the datagrid
Posted: Wed Oct 14, 2015 10:51 pm
Hi Guys,
I have a sql query which populates a variable called tTheData with about 5 fields from my SQLite database. I then use the following command to populate the datagrid with the data thats been returned.
set the dgText of group "myDataGrid" to tTheData
This all worked great, however Item 3 of each row in tTheData is a date field and I now need to store this in YYYY-MM-DD in a text field in my database so I can query against it fairly reliably. The problem is, I don't want it to display like that on my dg on my user interface, so I wrote a function called sqlToDMY which converts it to the display format I want to see it in. Question is, what is the best way to get the third row of data wrapped around my function, logic suggests a use a loop to go through tTheData and rewrite the 3 field and the set the dg, but which loop and is there an easier way?
Many thanks as always
Jalz
I have a sql query which populates a variable called tTheData with about 5 fields from my SQLite database. I then use the following command to populate the datagrid with the data thats been returned.
set the dgText of group "myDataGrid" to tTheData
This all worked great, however Item 3 of each row in tTheData is a date field and I now need to store this in YYYY-MM-DD in a text field in my database so I can query against it fairly reliably. The problem is, I don't want it to display like that on my dg on my user interface, so I wrote a function called sqlToDMY which converts it to the display format I want to see it in. Question is, what is the best way to get the third row of data wrapped around my function, logic suggests a use a loop to go through tTheData and rewrite the 3 field and the set the dg, but which loop and is there an easier way?
Many thanks as always
Jalz