Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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.

12 Replies
Not applicable
Author

Thanks Stefan.

llauses243
Creator III
Creator III

Hi,

For me the solution is posible from data with .txt no inline, pls to see image adjust

Good luck, Luis

swuehl
MVP
MVP

Luis, that's neat!

Haven't thought about that the inline load was causing the problem, thanks!

Stefan