Updating a data grid
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 151
- Joined: Sat Aug 25, 2012 1:14 am
Updating a data grid
I've wrestled with this for a while and can't see what is wrong. I'm trying got update a data grid with:
on FillInData pDataArray
set the text of field "EntryDate" of me to pDataArray[x]["label 5"]
set the text of field "lon" of me to pDataArray[x]["label 9"]
set the text of field "lat" of me to pDataArray[x]["label 10"]
set the text of field "Category" of me to pDataArray[x]["category"]
set the text of field "ItemName" of me to pDataArray[x]["itemname"]
set the text of field "ItemDesc" of me to pDataArray[x]["label 3"]
set the hilited of button "save location" of me to (pDataArray[x]["label 11"] is "true")
set the hilited of button "HIgh Rank" of me to (pDataArray[x]["label 6"] is "true")
set the hilited of button "Med Rank" of me to (pDataArray[x]["label 7"] is "true")
set the hilited of button "Low Rank" of me to (pDataArray[x]["label 8"] is "true")
set the text of field "Seq Numb" of me to pDataArray[x]["label 14"]
lock screen
set the dgData of group "wishlist" of card "wishlistCard" to pDataArray
set the dghilitedLines of group "wishlist" of card "wishlistcard" to 1
unlock screen
I can see the Array list but not update the template. The fields are mapped to the array.
Please help, I know it is right in front of me, but I just can't see it.
Thanks
Ty
on FillInData pDataArray
set the text of field "EntryDate" of me to pDataArray[x]["label 5"]
set the text of field "lon" of me to pDataArray[x]["label 9"]
set the text of field "lat" of me to pDataArray[x]["label 10"]
set the text of field "Category" of me to pDataArray[x]["category"]
set the text of field "ItemName" of me to pDataArray[x]["itemname"]
set the text of field "ItemDesc" of me to pDataArray[x]["label 3"]
set the hilited of button "save location" of me to (pDataArray[x]["label 11"] is "true")
set the hilited of button "HIgh Rank" of me to (pDataArray[x]["label 6"] is "true")
set the hilited of button "Med Rank" of me to (pDataArray[x]["label 7"] is "true")
set the hilited of button "Low Rank" of me to (pDataArray[x]["label 8"] is "true")
set the text of field "Seq Numb" of me to pDataArray[x]["label 14"]
lock screen
set the dgData of group "wishlist" of card "wishlistCard" to pDataArray
set the dghilitedLines of group "wishlist" of card "wishlistcard" to 1
unlock screen
I can see the Array list but not update the template. The fields are mapped to the array.
Please help, I know it is right in front of me, but I just can't see it.
Thanks
Ty
Re: Updating a data grid
Hi Ty,
pDataArray is a ONE dimensional array (the current index!), so leave out the [x] and all should be fine:
Best
Klaus
pDataArray is a ONE dimensional array (the current index!), so leave out the [x] and all should be fine:
Code: Select all
on FillInData pDataArray
set the text of field "EntryDate" of me to pDataArray["label 5"]
set the text of field "lon" of me to pDataArray["label 9"]
## etc...
end FillInData
Best
Klaus
-
- Posts: 151
- Joined: Sat Aug 25, 2012 1:14 am
Re: Updating a data grid
Klaus,
It looks like on of those dense days as I'm still doing something incorrectly.
I create the array from a text file in the preopencard
put url ("file:" & specialFolderPath("documents") & "/ItemList.txt") into tItem
put tItem into pDataArray
split PDataArray by return and tab
I've tried to dispatch it to the group with the same results.
then map it with the label and file of the data grid in the fillindata script portion an am still getting a empty return.
Thanks for the help
Ty
It looks like on of those dense days as I'm still doing something incorrectly.
I create the array from a text file in the preopencard
put url ("file:" & specialFolderPath("documents") & "/ItemList.txt") into tItem
put tItem into pDataArray
split PDataArray by return and tab
I've tried to dispatch it to the group with the same results.
then map it with the label and file of the data grid in the fillindata script portion an am still getting a empty return.
Thanks for the help
Ty
Re: Updating a data grid
Can you post some lines of that TXT file?
I am not sure if using split will produce the correct format for the dg array!
I am not sure if using split will produce the correct format for the dg array!
Re: Updating a data grid
Quick questions:
1. You do have that FillInData handler in the ROW BEHAVIOR of the datagrid, right?
2. the datagrid you are trying to update is NOT this one (hopefully) -> group "wishlist" of card "wishlistCard"
No idea what this line actualy does:
...
set the dgData of group "wishlist" of card "wishlistCard" to pDataArray
...
This will that datagrid for EVERY index repeat loop anew!?
1. You do have that FillInData handler in the ROW BEHAVIOR of the datagrid, right?
2. the datagrid you are trying to update is NOT this one (hopefully) -> group "wishlist" of card "wishlistCard"
No idea what this line actualy does:
...
set the dgData of group "wishlist" of card "wishlistCard" to pDataArray
...
This will that datagrid for EVERY index repeat loop anew!?
-
- Posts: 151
- Joined: Sat Aug 25, 2012 1:14 am
Re: Updating a data grid
1388713620 Table Set A wood table seet with chairs No Date Table and chairs Not Lat No Long No Picture false true false false 1/2/14 8:47:55 PM
1388713680 lamps set gold lamps set No Date lamps and stuff Not Lat No Long No Picture true false false false 1/2/14 8:48:21 PM
1388713680 wood table oak table with center leaf No Date table Not Lat No Long No Picture true false false false 1/2/14 8:48:46 PM
The script was generated though the data grid helper and I modified it.
Yes it is wish list of card wishlistcard, that must be a problem.
1388713680 lamps set gold lamps set No Date lamps and stuff Not Lat No Long No Picture true false false false 1/2/14 8:48:21 PM
1388713680 wood table oak table with center leaf No Date table Not Lat No Long No Picture true false false false 1/2/14 8:48:46 PM
The script was generated though the data grid helper and I modified it.
Yes it is wish list of card wishlistcard, that must be a problem.
Re: Updating a data grid
Please answer question 1, most important!
If that is really the dataqgrid then your are somehow updating the dategrid
while updateing the same datagrid(?), which cannot be healthy
it might be a good idea to go through the complete datagrid PDF to get the basics
of datagrids, which ARE in fact highly complex!
http://lessons.runrev.com/m/datagrid
Best
Klaus
If that is really the dataqgrid then your are somehow updating the dategrid
while updateing the same datagrid(?), which cannot be healthy

it might be a good idea to go through the complete datagrid PDF to get the basics
of datagrids, which ARE in fact highly complex!
http://lessons.runrev.com/m/datagrid
Best
Klaus
-
- Posts: 151
- Joined: Sat Aug 25, 2012 1:14 am
Re: Updating a data grid
Yes, it is in the row behavior script.
So it appears that I am updating twice?
So it appears that I am updating twice?
Re: Updating a data grid
Hi Ty,
In any case remove these lines from your script:
...
lock screen
set the dgData of group "wishlist" of card "wishlistCard" to pDataArray
set the dghilitedLines of group "wishlist" of card "wishlistcard" to 1
unlock screen
...
"FillInData" is part of the "command chain" that is invoked when you "set the dgdata of grp xyz to ..."!
So I really wonder why you did not get a "recursion limit" error!?
Best
Klaus
tyarmsteadBUSuSfT wrote:Yes, it is in the row behavior script.

Yep, even more -> (the number of keys of the dg array) times!tyarmsteadBUSuSfT wrote:So it appears that I am updating twice?
In any case remove these lines from your script:
...
lock screen
set the dgData of group "wishlist" of card "wishlistCard" to pDataArray
set the dghilitedLines of group "wishlist" of card "wishlistcard" to 1
unlock screen
...
"FillInData" is part of the "command chain" that is invoked when you "set the dgdata of grp xyz to ..."!
So I really wonder why you did not get a "recursion limit" error!?

Best
Klaus
-
- Posts: 151
- Joined: Sat Aug 25, 2012 1:14 am
Re: Updating a data grid
Klaus,
I have gone through the tutorial multiple times, but will walk thought it again.
Thank you for your help
Ty
I have gone through the tutorial multiple times, but will walk thought it again.
Thank you for your help
Ty
-
- Posts: 151
- Joined: Sat Aug 25, 2012 1:14 am
Re: Updating a data grid
Still can get it to populate the data grid.
What I am doing is creating a text file and then using the data from the text file with multiple lines (tab delim) to create the array. I then need to populate the data grid. I've gone round and round on this to point I'm really confused. I have review the tutorial serval times to no avail. the tutorial: http://lessons.runrev.com/s/lessons/m/d ... -of-people using the set the data control seems to be what I want to do, yet I still can not get it to work. Any arise would be greatly appreciated.
Thank you
Ty
What I am doing is creating a text file and then using the data from the text file with multiple lines (tab delim) to create the array. I then need to populate the data grid. I've gone round and round on this to point I'm really confused. I have review the tutorial serval times to no avail. the tutorial: http://lessons.runrev.com/s/lessons/m/d ... -of-people using the set the data control seems to be what I want to do, yet I still can not get it to work. Any arise would be greatly appreciated.
Thank you
Ty
Re: Updating a data grid
Hi Ty,
please post the code you use to create an ARRAY from your TAB delimited file!
Best
Klaus
please post the code you use to create an ARRAY from your TAB delimited file!
Best
Klaus
-
- Posts: 151
- Joined: Sat Aug 25, 2012 1:14 am
Re: Updating a data grid
(I've tried with and without the [x])
I can see the data in the "show data" option in the data grid helper
set itemDel to tab
put url ("file:" & specialFolderPath("documents") & "/ItemList.txt") into tItem
put tItem into pDataArray
----I have also tried it with and without the split
split PDataArray by return and tab
get number of lines of tItem
put it into tNumbLines
repeat with x = 1 to the number of lines of tItem
put item 5 of line x of tItem into pDataArray[x]["Category"]
put item 2 of line x of tItem into pDataArray[x]["ItemName"]
put item 3 of line x of tItem into pDataArray[x]["label 3"]
put item 4 of line x of tItem into pDataArray[x]["label 5"]
put item 6 of line x of tItem into pDataArray[x]["label 10"]
put item 7 of line x of tItem into pDataArray[x]["label 9"]
end repeat
dispatch AddData to group "WishList" of card me with pDataArray
Thank you,
Ty
I can see the data in the "show data" option in the data grid helper
set itemDel to tab
put url ("file:" & specialFolderPath("documents") & "/ItemList.txt") into tItem
put tItem into pDataArray
----I have also tried it with and without the split
split PDataArray by return and tab
get number of lines of tItem
put it into tNumbLines
repeat with x = 1 to the number of lines of tItem
put item 5 of line x of tItem into pDataArray[x]["Category"]
put item 2 of line x of tItem into pDataArray[x]["ItemName"]
put item 3 of line x of tItem into pDataArray[x]["label 3"]
put item 4 of line x of tItem into pDataArray[x]["label 5"]
put item 6 of line x of tItem into pDataArray[x]["label 10"]
put item 7 of line x of tItem into pDataArray[x]["label 9"]
end repeat
dispatch AddData to group "WishList" of card me with pDataArray
Thank you,
Ty
Re: Updating a data grid
Hi Ty,
ah, oh, I see
Is this a "mouseup" script?
OK, here some working code:
##dispatch "AddData" to group "WishList" of card me with pDataArray
"addata" will ADD data to an exitsing datagrid but will NOT accept
a multidimensional array, since it is only meant to add ONE record.
And "... of card me" is invalid syntax!
You can use "... of THIS cd" or, if it is in the card script: "... of ME"
Best
Klaus
ah, oh, I see

Is this a "mouseup" script?
OK, here some working code:
Code: Select all
...
set itemDel to tab
put url ("file:" & specialFolderPath("documents") & "/ItemList.txt") into tItem
## Don't:
## put tItem into pDataArray
## split PDataArray by return and tab
## This will "spoil" the ARRAY that you are building below!
## get number of lines of tItem
## put it into tNumbLines
## This will create an array in the correct format for the datagrid:
repeat with x = 1 to the number of lines of tItem
put item 5 of line x of tItem into pDataArray[x]["Category"]
put item 2 of line x of tItem into pDataArray[x]["ItemName"]
put item 3 of line x of tItem into pDataArray[x]["label 3"]
put item 4 of line x of tItem into pDataArray[x]["label 5"]
put item 6 of line x of tItem into pDataArray[x]["label 10"]
put item 7 of line x of tItem into pDataArray[x]["label 9"]
end repeat
## OK, ARRAY is ready, now we "fill" the datagrid with data:
set the dgdata of grp "WishList" to pDataArray
## DONE! :D
...
"addata" will ADD data to an exitsing datagrid but will NOT accept
a multidimensional array, since it is only meant to add ONE record.
And "... of card me" is invalid syntax!
You can use "... of THIS cd" or, if it is in the card script: "... of ME"
Best
Klaus
-
- Posts: 151
- Joined: Sat Aug 25, 2012 1:14 am
Re: Updating a data grid
Actually it was to set the array in the preopencard and pass to the fillindata of the data grid.
Ty
Ty