cancel
Showing results for 
Search instead for 
Did you mean: 
Nitrox7
Level 1
14 11 0 1
Message 1 of 3
758
Flag Post

Solved!

Creative an interactive form with the INPUT command - HP Prime

HP Recommended

I'm trying to develop a program that creates an INPUT form based on a certain user selection. I have found how to create the lists which should be used as the arguments of the INPUT command. However, the {VARS} list causes a problem because if I declare the variables as LOCAL, when the vars list is inserted instead of the actual variable name, say "a1", the value of the variable is recalled by the system so instead of a variable, the list shows its value. If I do not define the variable, the INPUT command then gives an error as it does not recognize the variables because they have not been declared.

 

For clarity, say I declare the variables a1, a2 & a3 as LOCAL.

 

The {vars} list should be {{a1,[0],{15,30,0}},{a2,[0],{15,60,0}},{a3,[0],{15,30,1}}}. However, when the list is inserted in the INPUT command, it shows {{0,[0],{15,30,0}},{0,[0],{15,60,0}},{0,[0],{15,30,1}}} because the system is using the variable value rather than its name. If I don't declare the variable then I do get the right {vars} list, but the program gives an Invalid Input error because it cannot find the variable declaration.

 

I'm wondering if anyone have found a solution to this conundrum...

 

As always, your help, comments and/or suggestions will be appreciated.

 

Thank you,

 

nitrox7

0 Kudos
2 REPLIES 2
cyrille
Level 6
Level 6
252 251 42 77
Message 2 of 3
Flag Post
HP Recommended

Hello,

 

It might be that doing an INPUT(eval(local_var_name)...) might work (I do not remember if I have implemented it or not...

 

Else, expr is your friend there:

expr("input("+var+"rest of imput command");

 

Cyrille

I am an HP Employee
Nitrox7
Author
Level 1
14 11 0 1
Message 3 of 3
Flag Post
HP Recommended

Hi Cyrille,

 

Thanks for the suggestion. It ended being a combination of EXPR() and STRING() what finally did the trick.

 

So instead of doing INPUT(EXPR()) as I've tried unsuccesfully, I followed your advise and used EXPR("INPUT("+STRING({Arguments of INPUT that I had already created)+")") and, voila, I have an interactive input form.

 

Thank you again!

 

Regards,

 

Nitrox7

0 Kudos
† The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation