How to Export a Pivot Table Using IdeaScript?

8 posts / 0 new
Last post
jsandoval
Offline
Joined: 03/01/2021 - 10:48
How to Export a Pivot Table Using IdeaScript?

Hello,
I'm trying to export a pivot table but I don't know the code to do this. I already know how to export it by using the interface of IDEA, but I need to create a script to automate the process and users just have to look for the excel in the export folder. Does anyone know how to do it?

Brian Element's picture
Brian Element
Online
Joined: 07/11/2012 - 19:57

When you are in the Pivot Table there is an option to generate the IDEAScript code for your pivot table.  Just select it and it will open in the IDEAScript editor.

jsandoval
Offline
Joined: 03/01/2021 - 10:48

Hello Brian,
Thanks for your quick response.
What I am trying to do is to export a pivot table to an excel file. I know if I click on the icon circled in red, I can export it, but that doesn't generate IdeaScript Code. If it was a database, I would use a code like this:
Set db = Client.OpenDatabase("Database Name.IMD")
Set task = db.ExportDatabase
Since this is a pivot table instead of a database. What code should I use to export it?

Images: 
Brian Element's picture
Brian Element
Online
Joined: 07/11/2012 - 19:57

First export the pivot table to IDEA and then export the new IDEA pivot database to Excel.

mwiger
Offline
Joined: 07/29/2021 - 10:01

Hello Brian,
 
The pivot table that I created will not let me export to an IDEA database. I have multiple data fields.  I get the error that the pivot table can only contain one row, column and data field when exporting. 
 
Is there another way to export this pivot table via IDEAScript?
 
Thanks

Brian Element's picture
Brian Element
Online
Joined: 07/11/2012 - 19:57

Hi mwiger,

Unfortunately the export to database only allows you to expert one row, one column and one data field.  The way to get around this is to create a new field and merge your fields together before creating the pivot table, this way you will be able to do the export.

mwiger
Offline
Joined: 07/29/2021 - 10:01

Hi Brian,
 
I currently have a pivot table that has 2 row fields.  I am able to send the pivot table to Excel but I am not able to see the code for the export.  Is there a way that I can find the code that exports the pivot table to Excel? 
 
Thanks

Brian Element's picture
Brian Element
Online
Joined: 07/11/2012 - 19:57

Sorry, they didn't implement any code to do this, only to export to IDEA and you can't do an IDEA export with two rows, only one row.