Post Reply 
Contents of variables erased by entering editor.
01-07-2014, 09:22 PM
Post: #1
Contents of variables erased by entering editor.
When the program below is executed it prints
'TESTVAR contains xyz'

After entering and exiting the editor with or without doing anything, all of a program's global variables contents are set to ZERO!!!

The program now prints
'TESTVAR contains 0.00'

This happens with the editor in the Virtual Prime or in the Connectivity Kit.

Someone tell me I am doing something wrong or that this is a flaw in the Prime.

TESTVAR is located in Var > [/i][/b] User > Program Variables > Variable Content

Thanks in advance for any help.

EXPORT TESTVAR;// TESTVAR contains xyz
EXPORT Variable_Content()
BEGIN
PRINT();// Clear the terminal display
PRINT("TESTVAR contains "+TESTVAR);// Print the
// contents of the global variable TESTVAR
END;

Happy coding and may you see ' i No errors in the program ' with every compilation.
Find all posts by this user
Quote this message in a reply
01-07-2014, 11:04 PM
Post: #2
RE: Contents of variables erased by entering editor.
Every time you enter the program editor and then exit, you re-compile the program and reset all the variables that are defined there. If you want to retain a value, then you must assign it inside the program, i.e. TESTVAR:='xyx';
Find all posts by this user
Quote this message in a reply
01-07-2014, 11:33 PM
Post: #3
RE: Contents of variables erased by entering editor.
Many thanks Michael.

Where in the documentation did you learn of this?

Happy coding and may you see ' i No errors in the program ' with every compilation.
Find all posts by this user
Quote this message in a reply
01-07-2014, 11:52 PM
Post: #4
RE: Contents of variables erased by entering editor.
Starting on page 511 of the User Guide there is a discussion of using variables in programs, although it doesn't clearly explain this issue. I figured it out with the help of other posters on this forum.
Find all posts by this user
Quote this message in a reply
01-08-2014, 12:19 AM (This post was last modified: 01-08-2014 12:33 AM by veeblefester.)
Post: #5
RE: Contents of variables erased by entering editor.
Thanks again Michael.

It occurred to me that this will not work because the contents of my variables
are VARIABLE. That is to say that contents of the variables I will be using are
dynamic not static. The value is based on user input.

This is another terrible limitation of the HP PPL.

Other examples: No way to indirectly address. This one really hurts!
An arbitrary limit of 14 CHOOSE items. I needed 20.
No way to backup User Variables.
I am starting to think I will go back to 50g to create apps.

HP should have published an Advanced User Guide as they did with previous machines.

Thanks again for your input.

Happy coding and may you see ' i No errors in the program ' with every compilation.
Find all posts by this user
Quote this message in a reply
01-08-2014, 01:56 AM
Post: #6
RE: Contents of variables erased by entering editor.
There is no limit on choose. Rather, you have two choices in how to operate it. Either you pass it individual arguments or a single list with all the arguments.

TW

Although I work for HP, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
01-08-2014, 01:59 AM
Post: #7
RE: Contents of variables erased by entering editor.
(01-08-2014 12:19 AM)veeblefester Wrote:  Thanks again Michael.

It occurred to me that this will not work because the contents of my variables
are VARIABLE. That is to say that contents of the variables I will be using are
dynamic not static. The value is based on user input.

This is another terrible limitation of the HP PPL.

Other examples: No way to indirectly address. This one really hurts!
An arbitrary limit of 14 CHOOSE items. I needed 20.
No way to backup User Variables.
I am starting to think I will go back to 50g to create apps.

HP should have published an Advanced User Guide as they did with previous machines.

Thanks again for your input.

There is no limit on the CHOOSE items if you use a list. As for variables, you can just create one from the Home screen and use it in your programs. They will act like global variables, and their contents are not touched by the compiler. This is not the ideal solution (because you must manually create it externally and not within a program), but it allows you to do what I think it is you want to do. User variables created from Home cannot be backed up (as far as I know, with the current conn. kit). However, variables created in programs are backed up with the source themselves via the .hppgrm or similar file extension. As for indirect addressing, you abandoned your thread on it without really ever explaining in full detail what it was you wanted to do.

I can empathize with you on the frustration of the lack of documentation. However, if you do truly want to figure out the new machine, I am sure many are here willing to help. That said, the HP50G is a very capable machine.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
01-08-2014, 08:37 PM
Post: #8
RE: Contents of variables erased by entering editor.
(01-08-2014 01:56 AM)Tim Wessman Wrote:  There is no limit on choose. Rather, you have two choices in how to operate it. Either you pass it individual arguments or a single list with all the arguments.

Tim, please point me to the place where I can read about these two choices.

Thanks

Happy coding and may you see ' i No errors in the program ' with every compilation.
Find all posts by this user
Quote this message in a reply
01-08-2014, 10:03 PM
Post: #9
RE: Contents of variables erased by entering editor.
(01-08-2014 08:37 PM)veeblefester Wrote:  
(01-08-2014 01:56 AM)Tim Wessman Wrote:  There is no limit on choose. Rather, you have two choices in how to operate it. Either you pass it individual arguments or a single list with all the arguments.

Tim, please point me to the place where I can read about these two choices.

Thanks

I'm not Tim, but you can find a description of this command on your Prime by entering:

<Toolbox> <Catlg> scroll to <CHOOSE> and highlight it but do not hit <Enter> key and then press <? Help> key.
Find all posts by this user
Quote this message in a reply
Post Reply 




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