Welcome to the Datanyx Community!

Get Help, Learn Best Practices, Network With Other Datanyx Users
I need to add filte...
 
Notifications
Clear all

I need to add filters in custom script. How do I do this?

1 Posts
1 Users
0 Likes
265 Views
Nikhila
(@nikhila)
Member Admin
Joined: 2 years ago
Posts: 338
Topic starter  
Step 1: Click on design and create a chart. 
Step 2: Drag and drop columns in dimension and measure.  
Step 3: Click on custom script and add custom script. (Refer to the image below). 
1672139485-customscript.png

Step 4: The user can add the filter query. It would look something like this: 

Select * From Sheet1 where column name =@Filter.Table name/custom script name 

Step 5: ‘Sheet1’ is the name of the data set in this particular example below.  

Step 6: The query for the following data will look like this. (Refer to the image below). 

1672139518-customscript2.png

For instance, if you want to add filter to the column ‘Segment’, the query will be: 

Select * From Sheet1 where Segment=@Filter.Sheet1 

Step 7: You are able to add different filters. You are able to add drop down and multiselect filters.  

Step 8: You need to use = to denote dropdown filter. IN is used to denote multiselect filter.  

Step 9: The example query in step 6 is for a normal drop-down filter.   

Step 10: You are able to add multiple filters. Refer to the example query below: 

Select * From Sheet1 where Segment=@Filter.Sheet1.Segment and Product IN(@Filter.Sheet1.Product)  

Step 11: The second part of the example in step 10 is for multi-select filter. Note that it needs to be given in brackets.  

Step 12: Once the query is done, click on show preview. (Refer to the images below). 

1672139591-customscript1.png
1672139615-customscript3.png

   
Quote
Share: