Page 1 of 1

Repeat does not work on populating DataGrid

Posted: Thu Apr 03, 2014 4:17 pm
by genie
Good day ya all!

Need help with populating DG.

I first did...
theDataA[1]["something"]
theDataA[2]["something"]
theDataA[3]["something"]

...worked OK. But when I tried again using repeat...

This displays one record only instead of 3.

Code: Select all

   repeat with tIndex = 1 to 3
      put "WO#12345" into theDataA["& tIndex &"]["wo_num"]
      put "mm/dd/yy" into theDataA["& tIndex &"]["date"]
      put "Technician: Name" into theDataA["& tIndex &"]["technician"]
      put "Location: longitude;latitude" into theDataA["& tIndex &"]["location"]
      put "Est time: hh:mm" into theDataA["& tIndex &"]["est"]
      put "Work to do:" into theDataA["& tIndex &"]["wtd"]
      put theImageFolder & "pin.png" into theDataA["& tIndex &"]["map"]
   end repeat
Why is that? Anything wrong here?


Thanks,
Genie

Re: Repeat does not work on populating DataGrid

Posted: Thu Apr 03, 2014 4:23 pm
by Klaus
Hi Genie,

what you first did was correct, but not in the repeat loop!

Why on earth did you put QUOTES around the key numbers? 8)
This will do:

Code: Select all

 repeat with tIndex = 1 to 3
      put "WO#12345" into theDataA[tIndex]["wo_num"]
      put "mm/dd/yy" into theDataA[tIndex]["date"]
      ## etc...
Best

Klaus

Re: Repeat does not work on populating DataGrid

Posted: Thu Apr 03, 2014 4:26 pm
by genie
Klaus wrote:Hi Genie,

what you first did was correct, but not in the repeat loop!

Why on earth did you put QUOTES around the key numbers? 8)
This will do:

Code: Select all

 repeat with tIndex = 1 to 3
      put "WO#12345" into theDataA[tIndex]["wo_num"]
      put "mm/dd/yy" into theDataA[tIndex]["date"]
      ## etc...
Best

Klaus

Waaaaaaahhhhhhh! I was thinking I am appending something. LOL.

Klaus! You are the fastest person on the planet! Thank you so much!

Now, Let me give that a try...

Re: Repeat does not work on populating DataGrid

Posted: Thu Apr 03, 2014 4:36 pm
by genie
Klaus wrote:

Code: Select all

 repeat with tIndex = 1 to 3
      put "WO#12345" into theDataA[tIndex]["wo_num"]
      put "mm/dd/yy" into theDataA[tIndex]["date"]
      ## etc...
That worked! I should have asked right away... I visited my erroneous script everyday for a couple of days and :(

Thank you!


Can I ask another OT question here?

How can I get the data of the clicked row in DataGrid? I tried to get "the clickedLine", but as expected, it works on the fields that composed the row, not the row of the data grid. I realize data grid is not a field. Or at least, how do I know what line was tapped?

Regards,
Genie

Re: Repeat does not work on populating DataGrid

Posted: Thu Apr 03, 2014 6:13 pm
by Klaus
Hi Genie,

you can query -> the dgHilitedIndex of grp "your datagrid here"

Do something like htis:
...
the dgHilitedIndex of grp "your datagrid here" into tIndex
put the dgDataOfIndex[tIndex] of grp "your datagrid here" into tDataArray
## Now you have an array with the data of the currently selected row
...

Best

Klaus

Re: Repeat does not work on populating DataGrid

Posted: Fri Apr 04, 2014 12:08 am
by genie
Klaus wrote:Hi Genie,

you can query -> the dgHilitedIndex of grp "your datagrid here"

Do something like htis:
...
the dgHilitedIndex of grp "your datagrid here" into tIndex
put the dgDataOfIndex[tIndex] of grp "your datagrid here" into tDataArray
## Now you have an array with the data of the currently selected row
...

Best

Klaus
Thanks for your help, Klaus.


Best Regards,
Genie