Page 1 of 1
How to store an array in
Posted: Thu Dec 06, 2018 4:16 pm
by Zax
Hello,
I have a standalone app with several cards. Each card has a field with styled text.
Is there a way to save all these cards fields in a
single xml file?
I know I can convert a styled field into an array with the command:
I also found how to store an array in a text file, but it doesn't solve my problem:
http://lessons.livecode.com/m/4071/l/95 ... e-it-again
Thank you.
Re: How to store an array in
Posted: Thu Dec 06, 2018 4:35 pm
by Klaus
Hi Zax,
does it have to be an ARRAY? "the htmltext of fld xyz" and "the rtftext of fld xyz" will also preserve the formatting of the field. This way you could also store everything into a XML file.
My XML-knowledge is a bit rusty, but you get the picture.
Best
Klaus
Re: How to store an array in
Posted: Thu Dec 06, 2018 5:04 pm
by dunbarx
What Klaus said.
I don't think the OP meant an array variable, only a dataset of some kind.
The word "array" is often misused this way.
Craig Newman
Re: How to store an array in
Posted: Thu Dec 06, 2018 5:25 pm
by FourthWorld
Does the output have to be XML? That's quite doable, but to explore the full range of options it would be helpful to know what programs will be consuming the data.
Re: How to store an array in
Posted: Thu Dec 06, 2018 5:49 pm
by Zax
Well, styledText seems to be a real array
http://livecode.wikia.com/wiki/StyledText
Concerning the XML format, I used to use XML file to store user's preferences. In this case, I would like to store styled texts of all cards. If my problem can be solved with another input/output format, it's OK for me.
Each card also has a title (its name in fact) that I also would like to store.
So, when the user launch the standalone, a text file should be read (XML or something else) to retreive cards' name and the corresponding styled text for each card.
Re: How to store an array in
Posted: Thu Dec 06, 2018 6:06 pm
by Klaus
Hi Zax,
yep, "the styledtext of fld xyz" not only seems to be, but in fact IS an ARRAY, that's why I was asking if this was mandatory.
Just create a node for each card with "number", "title" and "fieldcontent" (and/or whatever you need to save) and just store -> the htmltext of fld "your field here" in the latter one.
Then read that XML file in when the app starts the next time and re-create the fields content of each card.
Best
Klaus
Re: How to store an array in
Posted: Thu Dec 06, 2018 7:00 pm
by Zax
The htmltext of fld "MyStyledTextField" is the solution.
Problem solved, thank you very much, Klaus

Re: How to store an array in
Posted: Thu Dec 06, 2018 10:42 pm
by dunbarx
yep, "the styledtext of fld xyz" not only seems to be, but in fact IS an ARRAY
Yep.
I was thinking (not thinking at all?) about the htmlText
Craig