12 Replies Latest reply: Sep 7, 2011 7:38 PM by Stefan Wühl RSS

    How to insert function as part of dinamic expression created by script ?

      Hi guys,

       

      Need some help to solve the following:

       

      I have a table (chart) with a Group as dimension. 

      I create expressions dinamically from script.

       

      In one of my expressions, I have to use the function GetCurrentField(GroupName).

      The expression works ok as a regular expression in the chart:

       

      Sum(Invoices.LineTotalNIS
      Sum( Distinct Total <InvoiceKey1, Invoices.KLine, OrdIKey1, $(vCurrentField)> Orders.PurchasePriceNIS * Invoices.TQuant)  

      Where the variable vCurrentField= GetCurrentField(Display2)

       

       

      In the Script, I define the following expression:

       

      Sum(Invoices.LineTotalNIS
      Sum( Distinct Total <InvoiceKey1, Invoices.KLine, OrdIKey1, $(vCurrentField)> Orders.PurchasePriceNIS * Invoices.TQuant)  

      If I replace the variable by one of the dimension in the group it works.

       

       

      I tried also:

       

      Sum(Invoices.LineTotalNIS
      Sum( Distinct Total <InvoiceKey1, Invoices.KLine, OrdIKey1, $(=vCurrentField)> Orders.PurchasePriceNIS * Invoices.TQuant)  

       

      And

       

      Sum(Invoices.LineTotalNIS
      Sum( Distinct Total <InvoiceKey1, Invoices.KLine, OrdIKey1,
      GetCurrentField(Display2)

      Orders.PurchasePriceNIS * Invoices.TQuant)  

       

      How can I work it around?

       

      Thanks in advance,

      Aldo.