Post Reply 
How can I maintain a variables value when editing a Program or App
12-17-2014, 07:33 PM
Post: #2
RE: How can I maintain a variables value when editing a Program or App
One way I thought about doing this the following:

1. Use a user-created variable. If the variable doesn't exist, prompt the user to create it by typing in something like: SaveData:=0; in the Home view. The app should never proceed if this variable doesn't exist. So how do we test if it exists without compile errors? Via indirection.

Code:
LOCAL MyData;
IFERR
 MyData:=EXPR("SaveData");
THEN
  AbortApp();
END;

The AbortApp() routine should display a message telling the user how to create the variable SaveData. It should also contain the KILL command to completely exit the program/app. If there is no error, then all your data is imported into MyData and you can proceed as usual. If MyData is a list of stuff, then MyData(1) will get the 1st element, MyData(2) will get the 2nd element, etc.

2. To save your data, encapsulate everything into a single list and store it into MyData. Now, export using:

Code:

MyData:={ blah, blah, blah };
LOCAL cmd:="SaveData:=";
cmd:=cmd+MyData; // may possibly need to call string(MyData)
EXPR(cmd);

Thus you use MyData to access the data, and the EXPR() command to do your importing and exporting. Anytime you change your code, SaveData is unchanged. And compiling doesn't produce errors since there is no direct reference to SaveData.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: How can I maintain a variables value when editing a Program or App - Han - 12-17-2014 07:33 PM



User(s) browsing this thread: 1 Guest(s)