Page 1 of 1

format data before setting the datagrid

Posted: Wed Oct 14, 2015 10:51 pm
by jalz
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

Re: format data before setting the datagrid

Posted: Thu Oct 15, 2015 2:26 pm
by dunbarx
Hi.

Always best to format DG stuff is in the clear. So, yes, change tTheData using chunk and delimiter tools, and then load into the dataGrid.

Craig Newman

Re: format data before setting the datagrid

Posted: Thu Oct 15, 2015 3:12 pm
by Klaus
You could add a custom behaviour to that namely column and script a "fillindata" handler for that,
but looping through the data first seems to be a lot more straightforward and easier! :D