Post Reply 
Delete all user defined variables
06-01-2015, 02:46 PM
Post: #1
Delete all user defined variables
HVars is a list of HOME user defined variables. DelHVars requires either the element number or the element name from the HVar list, in order to delete a user defined variable. Too bad DelHVars(); doesn't just delete them all, as its namesake implies.

Aside from block loops, is there another way to delete ALL of the user defined variables in the HVars list, via command line or programmatically (without the Vars or Mem keys)?

-Dale-
Find all posts by this user
Quote this message in a reply
06-01-2015, 02:57 PM (This post was last modified: 06-01-2015 02:57 PM by Tim Wessman.)
Post: #2
RE: Delete all user defined variables
We specifically did not allow that because the risk of accidentally typing something wrong... and boom - all gone.

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
06-01-2015, 03:10 PM
Post: #3
RE: Delete all user defined variables
Well... you seem to have done a good job! Any hints on how we can defeat that limitation(???)

-Dale-
Find all posts by this user
Quote this message in a reply
06-01-2015, 03:36 PM (This post was last modified: 06-01-2015 04:12 PM by Didier Lachieze.)
Post: #4
RE: Delete all user defined variables
(06-01-2015 02:46 PM)DrD Wrote:  Aside from block loops, is there another way to delete ALL of the user defined variables in the HVars list, via command line or programmatically (without the Vars or Mem keys)?
This seems to work: EXECON("DelHVars(&1)",HVars)
It deletes all user defined variables and returns a list with the status of each variable deletion (should be a list of "1"s if deleted successfully).

EDIT: if you want to avoid an error message "Error: Invalid input" if there is no user defined variables, then you can do:
IFTE(SIZE(HVars),EXECON("DelHVars(&1)",HVars),0)
Find all posts by this user
Quote this message in a reply
06-01-2015, 04:19 PM
Post: #5
RE: Delete all user defined variables
Good catch! I like the idea of the list of success values. Thanks!

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




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