1 Reply Latest reply: Feb 23, 2017 7:49 AM by sasi k RSS

    Error line scripting

    Eduard Cabanas Gili

      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);

        • Re: Error line scripting
          sasi k

          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);

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