HP Forums

Full Version: Delete all user defined variables
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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-
We specifically did not allow that because the risk of accidentally typing something wrong... and boom - all gone.
Well... you seem to have done a good job! Any hints on how we can defeat that limitation(???)

-Dale-
(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)
Good catch! I like the idea of the list of success values. Thanks!

-Dale-
Reference URL's