Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

datanibbler
Esteemed Contributor

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
Contributor III

Re: Introduce a field calculated with a variable into a LOAD statement

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.

5 Replies
Not applicable

Re: Introduce a field calculated with a variable into a LOAD statement

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

Highlighted
datanibbler
Esteemed Contributor

Re: Introduce a field calculated with a variable into a LOAD statement

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

Re: Introduce a field calculated with a variable into a LOAD statement

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
Contributor III

Re: Introduce a field calculated with a variable into a LOAD statement

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
Esteemed Contributor

Re: Introduce a field calculated with a variable into a LOAD statement

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