Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Team,
Im trying to pass user filtered data through an api in using getcurrentfield in data load editor but throws the following error.
could anyone help to solve.
Thanks in Advance
Here is my code
Orders:
Load
OrderDate,
Year(OrderDate) & '-' & Num(Month(OrderDate), '00') as OrderMonth,
Product,
OrderValue
Inline [
OrderDate, Product, OrderValue
2022-01-23, A, 120
2022-02-14, A, 200
2022-03-03, A, 300
2022-04-13, A, 150
2022-01-03, B, 300
2022-01-05, B, 350
2022-02-12, B, 200
2022-03-18, B, 250
2022-04-02, B, 200
];
Products:
Load * Inline [
Product, ProductName
A, Apple
B, Banana
];
// ---------------------------------------
// Prepare single table for GPT-3 prompt
NoConcatenate
GPT_Source:
Load
OrderDate,
Product,
OrderValue
Resident Orders;
left join (GPT_Source)
Load
Product,
ProductName
Resident Products
;
//trace Evaluate('$(=GetCurrentSelections())');
// ---------------------------------------------------------
// Prepare list of all fields for JSON formating procedure
GPT_JSON:
Load
'*Orders*: [' & concat('{*OrderDate*: *'& OrderDate & '*, *Product*: *' & Product & '*, *ProductName*: *' & ProductName & '*, *OrderValue*: *' & OrderValue & '*}' , ',') & ']' as JSON
Resident GPT_Source where ProductName=$(vFilterInput);
I have declared vFilterInput as GetCurrentFieldSelections()
Error:
You can't. The load script is not aware of any selections in frontend. The GetCurrentSelections() function is a chart function only, not a script function.
Hey Henrikalmen,
thanks for the response. However i found a work around for this
first variable (vFilterInput)=getcurrentselections()
create a button with set variable action
here set vtext=text(vFilterInput)
so now everytime the user applies the filter and clicks this button the evaluated value will be stored in vtext and can be used in load editor as a regular variable.
The user would have to click the button with no selections made in order to be able to load all data again.
I'd recommend that you make it very clear in frontend that the application was reloaded using such a filter. For example, in loadscript you could do:
LET vInfoMessage = '$(vFilterInput)';
And then in the app you create a text object with something like "This app loaded data using this filter: $(vInfoMessage)'
Yeah agreed. However Im using Partial Reload for this.