storing data in a file
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
storing data in a file
Hi,
In another IDE we store our data as binary objects into a file.... we then offer file new, save, etc.
How do we do this in runrev and still make it cross platform for mac and windows?
i.e. suggestions on "storing data"
Also in VB6 we used "user defined types" to create the data structures... how does one organize data in memory in runrev?
Thanks
In another IDE we store our data as binary objects into a file.... we then offer file new, save, etc.
How do we do this in runrev and still make it cross platform for mac and windows?
i.e. suggestions on "storing data"
Also in VB6 we used "user defined types" to create the data structures... how does one organize data in memory in runrev?
Thanks
Re: storing data in a file
for basic stuf, you can put stuff into a file or binfile url. you can also save your data into stacks, or use databases, depending on your need. for text files this is pretty easy:
you do not mess with the data structure in memory livecode does all that behind the scenes for you, mostly this is because there is no variable types at all.
Code: Select all
ask file "where to save the data"
put theData into url ("file:" & it)
Various teststacks and stuff:
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
Re: storing data in a file
Where would I learn more about how we can structure "theData"? Our app has numerous complicated objects as well as a variable number of those objects that need to be stored... i.e. if we model say an "investment"... the client might have 7 or 27 investments... and each investment has a balance, contribution rate, return, etc.
Re: storing data in a file
Hi tturner43,
what exactly are the "complicated objects" you want to store in a file?
In any case it is up to you to define the structure of your data!
"theData" is just an arbitrary name for a variable in Björnkes example.
You can store binary data using the keyword "binfile" and any text using "file".
Example:
...
put variable_with_binary_data into url("binfile:" & specialfolderpath("desktop") & "/binary stuff.bin")
...
put variable_with_text into url("binfile:" & specialfolderpath("desktop") & "/a text file.txt")
...
Will save the stuff on your desktop
Best
Klaus
what exactly are the "complicated objects" you want to store in a file?
In any case it is up to you to define the structure of your data!
"theData" is just an arbitrary name for a variable in Björnkes example.
You can store binary data using the keyword "binfile" and any text using "file".
Example:
...
put variable_with_binary_data into url("binfile:" & specialfolderpath("desktop") & "/binary stuff.bin")
...
put variable_with_text into url("binfile:" & specialfolderpath("desktop") & "/a text file.txt")
...
Will save the stuff on your desktop
Best
Klaus
Re: storing data in a file
Yes I understand what he meant.... I am totally green to runrev... am trying to decide whether to use it or realbasic...
Looking for tutorial or examples on defining "theData" to see how that's done... so in "defining the structure of my data".... just need some examples on how that is done to see what it is like.
Thanks.
Looking for tutorial or examples on defining "theData" to see how that's done... so in "defining the structure of my data".... just need some examples on how that is done to see what it is like.
Thanks.
-
- VIP Livecode Opensource Backer
- Posts: 10043
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: storing data in a file
You can use stack files as documents. Kinda handy: properties can store even binary data, and cards can store native objects like images.
For tips on handling document files in a standalone, this article is helpful:
http://livecodejournal.com/tutorials/sa ... ution.html
For tips on handling document files in a standalone, this article is helpful:
http://livecodejournal.com/tutorials/sa ... ution.html
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn