Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
ecabanas
Creator II
Creator II

Error line scripting

Hi,

I'm doing a calculation when I load the scrip, and gives me an error, does anybody knows why did not work?

Thank's

Salesline:

LOAD

if(Payment_line_method='creditcard'or Payment_line_method='recurrent'or Payment_line_method='nopay' ,(sum(Import_Brut)*1.17)*0.006,

if(Payment_line_method='paypal',0.3+(sum(Import_Brut)*1.17)*0.017,

if(Payment_line_method='reposition',0))) as Finance_Cost,

* from $(VStore)Salesline.qvd (qvd);

STORE Salesline_P INTO $(VStore)Salesline.qvd (qvd);

1 Reply
sasikanth
Master
Master

HI,

As you are using Aggregation functions you should have to use a Group by statement within your script.

Here you can write script with out SUM() as well ,

try this,

*****************************************************

LOAD

if(Payment_line_method='creditcard'or Payment_line_method='recurrent'or Payment_line_method='nopay' ,( (Import_Brut)*1.17)*0.006,

if(Payment_line_method='paypal',0.3+( (Import_Brut)*1.17)*0.017,

if(Payment_line_method='reposition',0))) as Finance_Cost,

* from $(VStore)Salesline.qvd (qvd);

STORE Salesline_P INTO $(VStore)Salesline.qvd (qvd);

In front end you can use like  SUM(Finance_Cost) which is same as your expression

**********************************************************************************************************

Else try this....

************************************************************************************

LOAD

if(Payment_line_method='creditcard'or Payment_line_method='recurrent'or Payment_line_method='nopay' ,(sum(Import_Brut)*1.17)*0.006,

if(Payment_line_method='paypal',0.3+(sum(Import_Brut)*1.17)*0.017,

if(Payment_line_method='reposition',0))) as Finance_Cost,

* from $(VStore)Salesline.qvd (qvd)

Group by Payment_line_method;        (Assumed that only Payment_line_method field is available)

STORE Salesline_P INTO $(VStore)Salesline.qvd (qvd);

************************************************************************************