HP Forums
Access Note using string variable - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Access Note using string variable (/thread-9806.html)



Access Note using string variable - Stevetuc - 12-29-2017 02:52 PM

Notes("my.txt") works fine. (If my.txt exists under Notes)

But if I try say:
m1:="my.txt"
Notes(m1)
I get invalid input.

Ive tried various things using EXPR(STRING()) but no joy
Any ideas how to reference Notes via a stringvar?


RE: Access Note using string variable - Fortin - 12-29-2017 04:20 PM

I'm not aware of Notes(STR) working in any direct manner, but this can work via index: Notes(POS(Notes,STR))

Edit: Just tried and Notes(STR) does work directly. :-)


RE: Access Note using string variable - StephenG1CMZ - 12-29-2017 04:40 PM

(12-29-2017 02:52 PM)Stevetuc Wrote:  Notes("my.txt") works fine. (If my.txt exists under Notes)

But if I try say:
m1:="my.txt"
Notes(m1)
I get invalid input.

Ive tried various things using EXPR(STRING()) but no joy
Any ideas how to reference Notes via a stringvar?

Seems to work OK here on Android.
Code:

EXPORT TRYN()
BEGIN
 LOCAL m1:="my.txt";
 Notes(m1);

END;
The only time I saw Invalid Input was before I created the file, so I suggest checking the filename matches (I think it is case sensitive). Also suggest avoiding names like M1 just in case there is confusion with Matrix Number 1 (which cannot hold strings).
Are you seeing the Invalid Input when you assign a string to m1 or when you execute Notes(m1)?


RE: Access Note using string variable - Stevetuc - 12-29-2017 06:21 PM

(12-29-2017 04:40 PM)StephenG1CMZ Wrote:  Seems to work OK here on Android.
Code:

EXPORT TRYN()
BEGIN
 LOCAL m1:="my.txt";
 Notes(m1);

END;
The only time I saw Invalid Input was before I created the file, so I suggest checking the filename matches (I think it is case sensitive). Also suggest avoiding names like M1 just in case there is confusion with Matrix Number 1 (which cannot hold strings).
Are you seeing the Invalid Input when you assign a string to m1 or when you execute Notes(m1)?

Ive checked again and the problem seems to be due to the input statement I am using in my main program

Code:

EXPORT TRYN()
BEGIN
LOCAL m1;
INPUT(m1,"Enter Filename","Filename","",0,"my.txt");
Notes(m1);
END;

If the above is run and the default filename is accepted with OK, then Notes works fine. However if you click on the textbox, so that the string appears on the edit line, then even if you just ok without an edit, it throws "Invalid input"


RE: Access Note using string variable - toml_12953 - 12-29-2017 09:10 PM

(12-29-2017 06:21 PM)Stevetuc Wrote:  
(12-29-2017 04:40 PM)StephenG1CMZ Wrote:  Seems to work OK here on Android.
Code:

EXPORT TRYN()
BEGIN
 LOCAL m1:="my.txt";
 Notes(m1);

END;
The only time I saw Invalid Input was before I created the file, so I suggest checking the filename matches (I think it is case sensitive). Also suggest avoiding names like M1 just in case there is confusion with Matrix Number 1 (which cannot hold strings).
Are you seeing the Invalid Input when you assign a string to m1 or when you execute Notes(m1)?

Ive checked again and the problem seems to be due to the input statement I am using in my main program

Code:

EXPORT TRYN()
BEGIN
LOCAL m1;
INPUT(m1,"Enter Filename","Filename","",0,"my.txt");
Notes(m1);
END;

If the above is run and the default filename is accepted with OK, then Notes works fine. However if you click on the textbox, so that the string appears on the edit line, then even if you just ok without an edit, it throws "Invalid input"

Try adding the input type in the INPUT command. Without it, you have to enter the string in quotes.

Code:
INPUT({{m1,[2]}},"Enter Filename","Filename","",0,"my.txt");



RE: Access Note using string variable - Stevetuc - 01-01-2018 09:02 AM

(12-29-2017 09:10 PM)toml_12953 Wrote:  
(12-29-2017 06:21 PM)Stevetuc Wrote:  Ive checked again and the problem seems to be due to the input statement I am using in my main program

Code:

EXPORT TRYN()
BEGIN
LOCAL m1;
INPUT(m1,"Enter Filename","Filename","",0,"my.txt");
Notes(m1);
END;

If the above is run and the default filename is accepted with OK, then Notes works fine. However if you click on the textbox, so that the string appears on the edit line, then even if you just ok without an edit, it throws "Invalid input"

Try adding the input type in the INPUT command. Without it, you have to enter the string in quotes.

Code:
INPUT({{m1,[2]}},"Enter Filename","Filename","",0,"my.txt");

Thanks, that works well.