Create Pivot table from Ideascript
Forums
I am new to scritpting and have been utilizing history to create most of my scripts. I wanted to try and script to create a pivot table but unfortunatly when you create a pivot table there is no history to review. Is there a snippet or could someone share an example of how to create a pivot table in ideascript?
Is there any way to script
Is there any way to script exporting a pivot table with more than one row heading?
This would save a lot of time instead of having to remember to open up the database, open each result, wait for calc, click OK to close the dialog box, then click export to excel, and clicking Ok to save. For multiple databases and multiple pivot tables, this adds a lot of extra steps that I am hoping to bypass with scripting.
I just tried it and it won't
I just tried it and it won't allow you to send a file to IDEA with more that one column or row.
How you can get around this is put the two items together. So if you have a column for the year and another column for the month in your pivot table what you can do is in your file create a new field and call it something like YEAR_MONTH and then join the two fields together so the new field might have something like 2019-01, 2019-02 and so on. This way you have the information in the two fields but in only one field and you use this field in your pivot table which will be exported to an IDEA file.
I think that is about the only way to get around this limitation.
Good luck.
Brian
Hi Benoit, I have learned
Hi Benoit, I have learned since I posted this that you can't export a pivot table to IDEA if it has more than one row, column or data. That might be the problem. Here is some example code for you.
' Analysis: Pivot Table
Function PivotTable
Set db = Client.OpenDatabase("My File.IMD")
Set task = db.PivotTable
task.ResultName = "My Result"
task.AddRowField "ROW_FIELD"
task.AddColumnField "COLUMN_FIELD"
task.AddDataField "DATA_FIELD", "Sum: DATA_FIELD", 1
task.ExportToIDEA True
task.PerformTask
Set task = Nothing
Set db = Nothing
End Function
In fact, I wanted to create a
In fact, I wanted to create a pivot table to get just one single value of the differents JOURNALCODE values (whitout the duplicates).
extract of my database :
extract of my pivot table :
The purpose is to get the values of my pivot table into a listbox (in a dialog box).
Do you know if it's possible ?
Thank's in advance
Benoît
Hi Benoit,
Hi Benoit,
Sorry for the delay, here is an example of what I think you are trying to do. If you have any questions about the code let me know.
http://ideascripting.com/snippet/example-populating-drop-down-based-con…
Thanks
Brian
There is an option in the
There is an option in the pivot table to extract the IDEAScript code. Just open your pivot table and click on the IDEAscript icon and the script editor will open up with the code.