Page 1 of 1
how to let Livecode run json in proper format
Posted: Mon Jul 22, 2013 4:24 pm
by darkshadow
Hello everyone:
I'm just learned some fundamental knowledge of livecode, and recently got a project to do, but i'm really confuse in how to change the code below in proper format, in other words, like the general survey format we usually in the web (like the first picture) and display it in livecode.
Any suggestions?
Re: how to let Livecode run json in proper format
Posted: Mon Jul 22, 2013 8:04 pm
by Simon
Hi tkytky,
Either you've changed your name or this same job was given to you.
In any case this exact question was asked before:
http://forums.runrev.com/phpBB2/viewtop ... =9&t=16024
If you ask specific questions regarding implementation of specific aspects I'd be happy to help.
Now have you gone through the lessons?
http://lessons.runrev.com/
The scripting conference?
http://www.hyperactivesw.com/revscriptc ... ences.html
Have you read or browsed the User Guide (resources icon)?
Simon
Re: how to let Livecode run json in proper format
Posted: Tue Jul 23, 2013 2:06 am
by darkshadow
Hi Simon:
Thank you very much for your reply.
I'm not sure which one of the plugin file i should use.
Also, the tutorial in the livecode web has few thing about json, i only got json to array file from it.But it seems haven't too much help.
Re: how to let Livecode run json in proper format
Posted: Tue Jul 23, 2013 5:52 am
by Simon
Hi tkytky,
There is not a "button" or "plugin" you can use to get what you would like. You will have to code this yourself.
There are no LC samples or examples that turn the info you are getting into a form.
Do you understand this?
The parsing is easy (for some of us) and creating the form as well.
Try, and if it's not working post your code here.
Simon
Re: how to let Livecode run json in proper format
Posted: Tue Jul 23, 2013 5:58 am
by TKYTKY
Hi simon and darkshadow
By the way darkshadow wasnt me. But i guess darkshadow got the same problem as me .
Re: how to let Livecode run json in proper format
Posted: Tue Jul 23, 2013 6:01 am
by Simon
Not only the same problem but the same jason code.
Hey.. do you think it's your competitor?
Simon
Re: how to let Livecode run json in proper format
Posted: Tue Jul 23, 2013 6:05 am
by TKYTKY
I think we are doing on the same project and can`t get things going.
Btw simon do you have skype ?
Re: how to let Livecode run json in proper format
Posted: Tue Jul 23, 2013 6:09 am
by Simon
Yes I do, but Dave (dave_probertGA6e24 ) is good.
Maybe a bit acidic but I'm hoping a good guy.
Simon
Re: how to let Livecode run json in proper format
Posted: Tue Jul 23, 2013 6:14 am
by TKYTKY
Cause you been helping me since i posted my question. so i think you got an ideas what i m suppose to do.
I`m not sure about dave.
Re: how to let Livecode run json in proper format
Posted: Tue Jul 23, 2013 6:16 am
by Simon
Dave, step up to the plate.
Re: how to let Livecode run json in proper format
Posted: Tue Jul 23, 2013 6:20 am
by TKYTKY
Can you give me more clues about radio button and stuffs? i tried the last coding you gave me. Successfully separate those question apart. but i aint sure about the radio button
Re: how to let Livecode run json in proper format
Posted: Tue Jul 23, 2013 10:29 am
by dave_probertGA6e24
Thanks Simon - I was hoping to hide from this one

Ph-Neutral is what I aim for though
Darkshadow / TKYTKY,
Not too sure I can help here, but I can try.
To summarise - you have a JSON output from some source (either file or generated), you need to create livecode cards with each of the questions on it along with the A,B,C radio choices.
To load the JSON I can recommend the JSON Library by the late Mark Smith. You might have to search to find a copy though. There should be links on the forum or Revonline.
Once you have run the data through the parser you should then have an array or arrays contain a structured version of the JSON file.
You should then iterate through the appropriate array parts and use the 'create' command in LC to make a new 'field' or 'button', put the text into the new object and then position it (depending on the device you are targeting).
Radio buttons should be created inside a group so that they know that they should work together.
Handling the responses from the 'form' is usually based on a 'button' script which will then look at the radio group to get the answer and move on to the next screen.
Most of this is pretty obvious in terms of functionality. The fine detail of exactly how you want to do this is really up to you and the requirements of your overall task. There is no 'standard' tool to create and handle a form - because everyone's needs are different.
If you have looked at each of the lessons regarding creating components, using groups, and working with radio buttons then it's only a case of combining that knowledge via understanding and coding ability.
If you need more help then it would be best to post a few examples of the JSON formatted questions, and a picture of the required output and if someone is being really nice and has some spare time they might create an example stack for you.
Cheers,
Dave
(I hope my Milk intake was enough to reduce any Acidity

)
Re: how to let Livecode run json in proper format
Posted: Tue Jul 23, 2013 2:54 pm
by FourthWorld
Re: how to let Livecode run json in proper format
Posted: Thu Jul 25, 2013 12:50 am
by Simon
OK guilt got the better of me because I said I'd help if paid and he did offer. (just too small a job)
attached is the stack from Mark Smith modified for TKYTKY.
Mark did all the hard work I just present the info.
This will probably generate more questions.
Simon