-Karina.
Data Grids & Global Variables
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Data Grids & Global Variables
Hi all, I'm doing my project for advanced higher, which requires me to use cards which are navigated through buttons. When you press the button, it asks you to enter a, b, c, or d that will be assigned to a global variable, or instance "question1". There are 10 cards, each containing a question that will be answered when pressing the 'continue' button. Finally, when the questions are answered it should go to a card "overview" that would display your answers in a data grid. However, my problem is that it doesn't display anything in the data grid. I have tried numerous codes, but nothing works. What I initially need it do be able to do is gather answers in forms of global variables and put them into a data grid. All, and any help would be greatly appreciated.
-Karina.
-Karina.
Re: Data Grids & Global Variables
Hi Karina,
1. welcome to the forum!
2. Please check this thread, maybe this already helps:
http://forums.livecode.com/viewtopic.php?f=7&t=26478
If not, we need to look at your script(s)!
Best
Klaus
1. welcome to the forum!
2. Please check this thread, maybe this already helps:
http://forums.livecode.com/viewtopic.php?f=7&t=26478
If not, we need to look at your script(s)!
Best
Klaus
Re: Data Grids & Global Variables
Thanks Klaus! I got the global variables in each card like this:Klaus wrote:Hi Karina,
1. welcome to the forum!![]()
2. Please check this thread, maybe this already helps:
http://forums.livecode.com/viewtopic.php?f=7&t=26478
If not, we need to look at your script(s)!
Best
Klaus
global question1
on mouseUp
repeat until (question1 ="a") or (question1 ="A") or (question1 ="b") or (question1 ="B") or (question1 ="c") or (question1 ="C") or (question1 ="d") or (question1 ="D")
ask "Please enter your choice"
put it into question1
//If the result is cancel, exiting the procedure
if the result is cancel then exit to top
if (question1 <>"a") and (question1 <>"A") and (question1 <>"b") and (question1 <>"B") and (question1 <>"c") and (question1 <>"C") and (question1 <>"d") and (question1 <>"D") then
//Error message
answer "Please enter a, A, b, B, c, C, d, D. Thank you."
end if
end repeat
go to card "L1-2"
end mouseUp
I'm not sure if that is correct ^ As well as I initialized the variable type in a different card and now I'm not too sure how to put the content of the cards with the same code, but different variables into a data grid on a different card from these.
Re: Data Grids & Global Variables
Hi Karina,
here is a slightly shorter and better readable version of your script.
Advice: If the user does not enter the correct answer, do not trap him in an endless repeat loop, just have him click the button again!
But sorry, still dont understand what and how you want to fill your datagrid with?
Could you give a little example in pseudocode?
Best
Klaus
here is a slightly shorter and better readable version of your script.
Advice: If the user does not enter the correct answer, do not trap him in an endless repeat loop, just have him click the button again!
Code: Select all
global question1
on mouseUp
put "a,A,b,B,c,C,d,D" into tAnswers
ask "Please enter your choice"
put it into question1
## If the result is cancel, exiting the procedure
if the result = cancel then
exit mouseup
end if
if question1 is not in tAnswers then
## Error message
answer "Please enter a, A, b, B, c, C, d, D. Thank you."
exit mouseup
end if
go to card "L1-2"
end mouseUpCould you give a little example in pseudocode?
Best
Klaus
Re: Data Grids & Global Variables
Hey Klaus,
I managed to sort my data gird problem, thank you for the help with the variables! All your help is kindly appreciated!
I managed to sort my data gird problem, thank you for the help with the variables! All your help is kindly appreciated!