To add a script or event to the selected rows and columns in a pivot table in AIV, follow these steps:
Create a Pivot Table:
- Begin by creating a pivot table that includes rows, columns, and aggregation. For example, you can set the row to Country, the column to Month, and the aggregation to Sum of Price.
Access the Row Settings:
- Click on the Settings icon next to the row name where you want to add the script/event.
Enable the Script Option:
- In the settings menu, check the box labeled 'Script'. Once checked, a text area will appear at the bottom of the window for you to input your script.
Write Your Script:
- Enter your script in the provided text area. For example, you might use the following sample script to change the tab and apply a filter based on the clicked country name:
javascriptCopy code
var a = '{{country}}'; console.log(a); var tab = new CustomEvent("aiv-change-tab", { "detail": 1 }); window.parent.dispatchEvent(tab); setTimeout(function(){ var filter = new CustomEvent("aiv-filter-call", { "detail": {"country": a} }); window.parent.dispatchEvent(filter); });
Save Your Changes:
- After writing your script, click the Accept button to save your changes.
Test the Script:
- Switch to Preview mode to test your script functionality. Click on the relevant data in the pivot table to see if the script executes as intended.
For any inquiries, please reach out to our support team at support@aivhub.com.
- Switch to Preview mode to test your script functionality. Click on the relevant data in the pivot table to see if the script executes as intended.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article