Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
datanibbler
Champion
Champion

Introduce a field calculated with a variable into a LOAD statement

Hi,

this seems like something pretty straightforward - but it doesn't work, so it cannot be that straightforward...

I define a variable (a numeric value) on the "Main" tab of my script. On another tab, I want to introduce into a LOAD statement (from a qvd) a new field calculated from

the sum of two fields from the table I am just loading (both of which are numeric values) multiplied with that numeric variable.

When I try that, I keep getting the script error message that a closing bracket is missing - but the bracketing is correct. I've checked it. In the error message, the variable is already neatly resolved, so that's all right.

Can anybody give me a hint here, there must be something one has to keep in mind when using variables that I missed.

Thanks a lot!

Best regards,

DataNibbler

1 Solution

Accepted Solutions
kuba_michalik
Partner - Specialist
Partner - Specialist

You have defined v_Min_Price with a decimal comma. Number literals in script (and the variable contents are being treated as a number literal after expansion) have to be written with a decimal point, I think. Commas in script are syntactic elements, so that's probably why it throws errors, finding a comma where it is not expected.

View solution in original post

5 Replies
Not applicable

Show us your script - there might be something you're missing.

datanibbler
Champion
Champion
Author

Thanks for helping!

I post the code of my script - as much of it as is necessary for the question to become clear anyway.

Best regards,

DataNibbler

Not applicable

Use this expression just remove outer brackets it should work

(ITEM_PACKTIMES.SALES_PACKTIME + ITEM_PACKTIMES.SALES_PROCTIME) * $(v_Min_Price)  as Item_Price

kuba_michalik
Partner - Specialist
Partner - Specialist

You have defined v_Min_Price with a decimal comma. Number literals in script (and the variable contents are being treated as a number literal after expansion) have to be written with a decimal point, I think. Commas in script are syntactic elements, so that's probably why it throws errors, finding a comma where it is not expected.

datanibbler
Champion
Champion
Author

Hi,

I have done both - I removed the outer brackets and I replaced the comma with a dot in the variable definition - and it works.

Thanks a lot!

This is solved - proceed to next problem 😉

Best regards,

DataNibbler