Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
bravemongo
Contributor II
Contributor II

How can I filter my data in data load editor based on the current filters applied in the Sheet

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:

Unexpected token: '==', expected one of: ':', 'OPERATOR_PLUS', 'OPERATOR_MINUS', 'OPERATOR_MULTIPLICATION', 'OPERATOR_DIVISION', 'OPERATOR_STRING_CONCAT', 'like', ...
 
The error occurred here:
GPT_JSON: Load '*Orders*: [' & concat('{*OrderDate*: *'& OrderDate & '*, *Product*: *' & Product & '*, *ProductName*: *' & ProductName & '*, *OrderValue*: *' & OrderValue & '*}' , ',') & ']' as JSON Resident GPT_Source where ProductName>>>>>>==<<<<<<GetCurrentSelections()

 

Labels (5)
4 Replies
henrikalmen
Specialist
Specialist

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.

bravemongo
Contributor II
Contributor II
Author

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.

henrikalmen
Specialist
Specialist

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

bravemongo
Contributor II
Contributor II
Author

Yeah agreed. However Im using Partial Reload for this.