thanks Klaus... that was the script that I was using... when I put it in as such:
10 put GetDataOfLine(x,"Rating") of group "DataGrid 1" of Card "ExerciseCard" into theRating
I get the following error:
button "Get Exercises": compilation error at line 10 (Commands:missing ',') near "into" char 70.
The following code:
10 put GetDataOfLine(x,"Rating") into theRating
gets no error.
here's my set up:
On Card 1, there is a button "Get Exercises". The script is
Code: Select all
on mousedown
go to card "ExerciseCard"
send mouseup to button "Get Runity Exercises" of card "ExerciseCard"
---new script, faulty---
if the hilited of button "A" of card "OneVideo" then
put "3,4,6,7,8,9,10,11,12,13,14,15,16,17,19,20,21,23,24,26,30" into tAList
set the itemdelimiter to comma
repeat for each item x in TAList
put GetDataOfLine(x,"Rating") of group "DataGrid 1" of card "ExerciseCard" into theRating
put theRating + 1 into theRating
dispatch "SetDataOfLine" to group "DataGrid 1" of card "ExerciseCard" with x, "checked", true
dispatch "SetDataOfLine" to group "DataGrid 1" of card "ExerciseCard" with x, "Rating", theRating
end repeat
end if
--- old script---
if the hilited of button "E" of card "OneVideo" then
put "1,2,4,5,11,12,13,15,16,17,25,26,29" into tAList
set the itemdelimiter to comma
repeat for each item x in TAList
dispatch "SetDataOfLine" to group "DataGrid 1" of card "ExerciseCard" with x, "checked", true
dispatch "SetDataOfLine" to group "DataGrid 1" of card "ExerciseCard" with x, "Rating", +1
end repeat
end if
--etc. where button "A", "E", etc are check boxes
dispatch "RefreshList" to group "DataGrid 1" of card "ExerciseCard"
dispatch "SortDataByKey" to group "DataGrid 1" with "Rating", numeric, descending, false
end mousedown
I have a series of checkboxes on Card 1, and this script checks the "checked" or "not checked" status of them. If a certain box is checked, it checks a box, and should add 1 to the rating. So in the above 2 examples, line 1, 2, and 3 should have "1" in their rating, and line 4 should have "2" in it, because it appears in both lists.
On Card 2 (Called Card "ExerciseCard") there is a DataGrid. It starts blank. One column, form type. The row template has been altered to have a checkbox with label, and a field called "Rating". Also on this card is 2 buttons, one called "Get Pilates Exercises", and one called "Get Runity Exercises". These buttons populate the DataGrid with a different set of exercises per button, and put "0" into the rating and mark the checkboxes as unchecked. All of this, except the Rating field was done as per the working with check boxes tutorial
http://lessons.livecode.com/m/datagrid/ ... -data-grid .
The code I used in the behaviour script of the DG row template is:
Code: Select all
on FillInData pDataArray
set the label of button "Check" of me to pDataArray["label"]
set the hilited of button "Check" of me to pDataArray["checked"]
put pDataArray["Rating"] into field "Rating" of me
end FillInData
The script of the button on Card 1 (above) is designed to:
1. Go to Card "ExerciseCard",
2. push the button "Get Runity Exercises" to populate the DG with Runity exercises,
3. see if a box on Card 1 is checked, then check certain boxes on certain lines (the string of numbers comma delimited),
4. add 1 to the rating
5. repeat for all checkboxes on Card 1
6. refresh the DataGrid to show the new numbers
7. Sort the DataGrid so that the highest numbers are at the top.
I have tested everything else, and only the "add 1 to the rating" part is not working...
It seems that I can't GetDataOfLine outside of the DG, or outside of the current card??? Do I need to dispatch it as per the "SetDataOfLine" command?
It's a complex set up, and I prefer not to do complex, but it's the only way I can think to do what I want to do.
If it's too much to picture, I can email you the LC file and point you in the right direction...
XdM