Post Reply 
New Version: 2018.02.12 1.4.1.13441
02-24-2018, 10:33 PM
Post: #41
RE: New Version: 2018.02.12 1.4.1.13441
(02-22-2018 08:20 PM)Han Wrote:  Create your own custom 'store' and 'recall' functions that handle the data types you need. For example, you can create a RECSTO(record, recnum, label, value) function and RECRCL(record, recnum, label) to return the desired value.

Each record object should have the following structure:

{
{ "label1", "label2", ... , "labeln" },
{ value1_1, value1_2, ..., value1_n }, // this is the first record
{ value2_1, value2_2, ..., value2_n }, // this is the second record
...
}

The RECSTO function should use the supplied 'label' to find the appropriate index (using the first list in each record) for the value. So RECTSTO("MyRec", 2, "NAME", "Tom") should basically do something like:

records:=AFiles(record); // here record="MyRec"
labels:=records(1); // first list is always labels list
n:=POS(labels,label); // here label="NAME";
current:=records(recnum+1);
current(n):=value; // here value="Tom";
records(recnum+1):=current;
AFiles(record):=records;

Everything is generic. A long time ago I wrote a short how-to on creating dynamic variables; this is based on that idea.

http://www.hpmuseum.org/forum/thread-3362.html



Hello Han,
very interesting topic. I use the Prime also to store some data and for this i created a program able to handle exactly such data.

My data structure is the following:

{
{ "Title", "field1 name", field1_type, "label2", field2_type, ... , "labeln" },
{ value1_1, value1_2, ..., value1_n }, // this is the first record
{ value2_1, value2_2, ..., value2_n }, // this is the second record
...
}

The program read the first item of the list, understand the number and type of field, ask the user to populate the data and store the new record...

In HPPL it is very easy to implement a lot of small code to handle this data (add/modify/delete) records.

Maybe the more difficult part is the GUI where it is difficult to dynamically browse the data with the existing output commands.

I understand that your thread was to discuss how to dynamically create new variable and I am interested in better understanding the way you described with a code example if you have it.

thanks

Giancarlo
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: New Version: 2018.02.12 1.4.1.13441 - Giancarlo - 02-24-2018 10:33 PM



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