Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
datanibbler
Champion
Champion

Variables with SET - fine; with LET, the script causes errors?

Hi,

I have a numeric variable in my script - a price_per_minute. Up until now, that variable was fixed with >SET<, that worked fine.

Now that price_per_minute is calculated from a price_per_hr. So I thought it would make things smoother to use SET for that price_per_hr and consequently use LET for calculating the price_per_minute.

That, however, does not work: The script causes an error in the line where that variable (the price_per_minute) is being used in a LOAD statement.

Can anybody tell me why?

Thanks a lot!

Best regards,

DataNibbler

5 Replies
Not applicable

Hi Friedrich ,

    

     Can you please send those lines for better understanding actually what you are trying i s work well. So can you please send your script lines

Not applicable

Hi Friedrich,

variables created via "set" are substituted once, the others created via "let" are validated every time they are used. So the syntax for using set variables can be "vMySetVariable", let variables have to be used in this way: $(vMyLetVariable). Maybe this is the reason for your script error.

Regards Sacho

datanibbler
Champion
Champion
Author

Hi,

thanks to both of you for helping!

My current codeline is

SET v_Min_Price = 0.399666667;

What I would like to make it is

SET v_Hr_Price = 23.98;

LET v_Min_Price = $(v_Hr_Price) / 60;

That's what is not working, the script produces an error in a LOAD statement where that variable v_Min_Price is referenced.

I am currently using that "Dollar-expansion" every time I refer to numeric variables.

Thanks again!

Best regards,

DataNibbler

Not applicable

Hi,

this should also work: LET v_Min_Price = '$(v_Hr_Price) / 60';

Otherwise the script is o.k. Maybe you get the error in the context of a wrong decimal point syntax (german|english) ?

Best

Sacho

datanibbler
Champion
Champion
Author

Hi,

that also confused me a bit: I set the decimal point to >,< (german) on the "Main" tab of the script, but I still have to enter that variable with a >.<, otherwise the script will produce an error straight away.

More likely it was because of those inverted commas.

It WORKS. Wow! Thank you!

Best regards,

DataNibbler

P.S.: O_O - too early - it doesn't: When I have it like this

SET v_Hr_Price = 23.98;

LET v_Min_Price = '$(v_Hr_Price)/60';

a line in the next LOAD statement where I have a SUM formula does not work because the script replaces the >> $(v_Min_Price) << in that place with the entire formula, causing the line to fail...