Convert
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Convert
Hi guys
Please help. Really confuse with livecode.
I have to convert this text into a survey format in livecode but i dont know how to start.
Any suggestion / examples ?
{"survey_id": "1", "survey_title": "An exmaple of Pesonal Health Assessment Survey","questions":[{ "id": "Q1", "question": "I eat at fast food restaurant less than 3 times per week", "ans": [{"choice": "Strongly Agree"}, {"choice": "Agree"}, {"choice": "Neither Agree or Disagree"},{"choice": "Disgree"}, {"choice": "Strongly Disgree"}] },{ "id": "Q2", "question": "I eat at least 2 servings of vegetable everyday", "ans": [{"choice": "Strongly Agree"}, {"choice": "Agree"}, {"choice": "Neither Agree or Disagree"},{"choice": "Disgree"}, {"choice": "Strongly Disgree"}] },{ "id": "Q3", "question": "My favourite form of exercise", "ans": [{"choice": "Walking"}, {"choice": "Jogging"}, {"choice": "Yoga"}, {"choice": "Cycling"},{"choice": "Swimming"}, {"choice": "Others"}, {"choice": "I dont exercise"}] }]}
Please help. Really confuse with livecode.
I have to convert this text into a survey format in livecode but i dont know how to start.
Any suggestion / examples ?
{"survey_id": "1", "survey_title": "An exmaple of Pesonal Health Assessment Survey","questions":[{ "id": "Q1", "question": "I eat at fast food restaurant less than 3 times per week", "ans": [{"choice": "Strongly Agree"}, {"choice": "Agree"}, {"choice": "Neither Agree or Disagree"},{"choice": "Disgree"}, {"choice": "Strongly Disgree"}] },{ "id": "Q2", "question": "I eat at least 2 servings of vegetable everyday", "ans": [{"choice": "Strongly Agree"}, {"choice": "Agree"}, {"choice": "Neither Agree or Disagree"},{"choice": "Disgree"}, {"choice": "Strongly Disgree"}] },{ "id": "Q3", "question": "My favourite form of exercise", "ans": [{"choice": "Walking"}, {"choice": "Jogging"}, {"choice": "Yoga"}, {"choice": "Cycling"},{"choice": "Swimming"}, {"choice": "Others"}, {"choice": "I dont exercise"}] }]}
Re: Convert
Hi tkytky,
Do you know what "Parsing" is?
Sorry if it's a dumb question but it's what you'll be doing.
With a new stack drag a text entry field and a button onto it.
Paste your info into the field.
In the button code put:
Now that's just to get you going, you'll see that I left a bunch of junk in that you can remove.
I think that replace with cr & "id" will give you a clue how to distinguish separate parts of the input for use in individual fields and radio buttons.
If you have questions just ask.
Simon
Do you know what "Parsing" is?
Sorry if it's a dumb question but it's what you'll be doing.
With a new stack drag a text entry field and a button onto it.
Paste your info into the field.
In the button code put:
Code: Select all
on mouseUp
put fld 1 into tVar
replace quote with "" in tVar --remove all the junk
replace "{" with "" in tVar
replace ":" with "" in tVar
replace "id" with cr & "id" in tVar --put a return at the start so I can read it
put tVar into fld 1
end mouseUp
I think that replace with cr & "id" will give you a clue how to distinguish separate parts of the input for use in individual fields and radio buttons.
If you have questions just ask.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Convert
Hi.
Simon has tried to organize your data.
But you must learn the basics of text handling in LiveCode. This is based on what is known as "chunking". You have to read the user guide and dictionary, learning what distinguishes "words", "items", "lines" and other stuff.
LC contains enormous power in its ability to parse data, as Simon mentioned, and this is usually fun to do, in that you build data structures that can be deconstructed as desired to create information. But you need the basic tools.
Craig Newman
Simon has tried to organize your data.
But you must learn the basics of text handling in LiveCode. This is based on what is known as "chunking". You have to read the user guide and dictionary, learning what distinguishes "words", "items", "lines" and other stuff.
LC contains enormous power in its ability to parse data, as Simon mentioned, and this is usually fun to do, in that you build data structures that can be deconstructed as desired to create information. But you need the basic tools.
Craig Newman
Re: Convert
Thanks
I know what is parsing but i dont know how it works in livecode. Reading book like LIVE REFERENCE and still not sure how to do it. Wanted to find sample online to guide me through but there`s no livecode sample on survey
Can anyone give me an example how to make this application out ?
1) I am suppose to get the survey question in JSON format from http://intimes.eu.pn/getsurvey.php
2) Display the survey out with proper form ( sumbitbutton/radio button)
3) send the survey answer back to the server
I know what is parsing but i dont know how it works in livecode. Reading book like LIVE REFERENCE and still not sure how to do it. Wanted to find sample online to guide me through but there`s no livecode sample on survey
Can anyone give me an example how to make this application out ?
1) I am suppose to get the survey question in JSON format from http://intimes.eu.pn/getsurvey.php
2) Display the survey out with proper form ( sumbitbutton/radio button)
3) send the survey answer back to the server
Re: Convert
Hi tkytky,
Did you try out the code I posted?
I though it took you to a logical end result.
Maybe I'm misunderstanding, happens all the time to me. Maybe tell me where it isn't what you wanted?
Is it that you want code for setting the radio button, question, title names?
Nope don't know of any examples.
Simon
Did you try out the code I posted?
I though it took you to a logical end result.
Maybe I'm misunderstanding, happens all the time to me. Maybe tell me where it isn't what you wanted?
Is it that you want code for setting the radio button, question, title names?
Nope don't know of any examples.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Convert
Hi simon
Thanks for the reply
I try out the code that you posted . It help tidy up the codes.
and ya i want code for setting the radio button , question number, title name and a sumbit button but how do i get it ?
Thanks for the reply
I try out the code that you posted . It help tidy up the codes.
and ya i want code for setting the radio button , question number, title name and a sumbit button but how do i get it ?
Re: Convert
Ahhh, thats a bit more than I should do.
I'd like to think of this forum as a learning center, not a place for free code.
But I'm happy to give you some more clues.
Did you see what that did? Now every question and possible answer is on it's own line.
From there you can then parse out more.
"Put line 2 of tVar into tQuest"
Now parse that.
On the other hand if you pay me, I'll parse the whole thing out for you.
Simon
I'd like to think of this forum as a learning center, not a place for free code.
But I'm happy to give you some more clues.
Code: Select all
replace "id" with cr & "id" in tVar
From there you can then parse out more.
"Put line 2 of tVar into tQuest"
Now parse that.
On the other hand if you pay me, I'll parse the whole thing out for you.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Convert
HI TKYTKY,
take a look at these stacks to get the basics of Liveocode:
http://www.hyperactivesw.com/revscriptc ... ences.html
Best
Klaus
take a look at these stacks to get the basics of Liveocode:
http://www.hyperactivesw.com/revscriptc ... ences.html
Best
Klaus
Re: Convert
Thanks for the reply everyone
Simon do you have skype ? need some guide lines from you. And if i still cant do . might need you to do a sample for me . WIlll pay for that
Simon do you have skype ? need some guide lines from you. And if i still cant do . might need you to do a sample for me . WIlll pay for that
Re: Convert
Wicked cool!
Where are you located?
Simon
Where are you located?
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Convert
Hi simon
I lived in singapore. can you private message me your skype ? i will try some solution and if i cant do them . i need your help
I lived in singapore. can you private message me your skype ? i will try some solution and if i cant do them . i need your help