Sending Results to an IDEA database through IDEA scripting (e.g. Pivot Table)

10 posts / 0 new
Last post
Smiso
Offline
Joined: 03/07/2019 - 03:05
Sending Results to an IDEA database through IDEA scripting (e.g. Pivot Table)

Hello Everyone
 
I hope you are all well.
 
May you please assist?
 
I was wondering if there is a way to send your Pivot Table results through an IDEA script to an IDEA database, rather than having to go and manually select "Send to IDEA database" after you have created you Pivot table. The creation can be done through a script, its just the turning the results of the Pivot Table into an IDEA database that i dont know how to get around in scripting. 
 
If this has been addressed already in the past topics, please kindly the share a link.
 
Thank you very much, please kindly assist if this is possible.
 
Regards,
Smiso.
 

Images: 
Smiso
Offline
Joined: 03/07/2019 - 03:05

Hello
 
I have Just figured it out :). you just need to replace "False" with "True" on  "task.ExportToIDEA".
 
Thank you.
 

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

Hi Smiso, glad you were able to figure it out.   Good luck on your project.

Smiso
Offline
Joined: 03/07/2019 - 03:05

Hi Brian
 
I hope all is well.
 
Thank you for your response hey.
 
Now, I just have one question: Is it possible to delete the "Results" part e.g. Pivot Table, for a particular database? This will ensure that everytime I run a script my Pivot Table database does not change names. Currently everytime I run my script, IDEA detects that there is already a Result with the same name, and then IDEA save the new database with a new name by adding a "1" at the end of the name of the new database. Is it possible to detele results at all? so that I can replace the Pivot Table exported database and my original database name remains, everytime I run my script.
 
Regards,
 
Smiso.

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

Hi Smiso, unfortunately I don't know of a way and there is no documented way to do it.  Sorry, not the answer you wanted.

Well I asked a coworker and I was proven wrong this is great.  If you look in the language browser there are a few ways to do it:

Database.Delete All Results

Database.DeleteResultbyIndex

Database.DeleteResultByName

So there you go.  You would probably use the DeleteResultByName in your scenario.

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

Looks like the above is in newer versions of IDEA, I am not sure which version it was added.  I am using the most current version.

Smiso
Offline
Joined: 03/07/2019 - 03:05

Hi Brian
 
Thank you for the prompt response hey.
 
I am currently running this version: 10.1.6.3 (X86 ), i think this is version 10.3, Im not sure, you can confirm for me if I'm correct here.
 
Let me go ahead and try and use the solution above, I will report back if it works :).
 
Regards,
 
Smiso.

Smiso
Offline
Joined: 03/07/2019 - 03:05

Hi Brian
 
The "DeleteResultByName" solution is not working. I might be doing something wrong here, also Im not sure if its because of my current version, per the above. Just a note, I am not really a systems engineer, I like to automate tasks, for efficiency at work, so, I dont know much about programming. See, the error message on the screenshot.
 
Please see if you can help in any way.
 
Regards,
 
Smiso.

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

Here is the example code from the language browser:

Sub Main

' Open the database.

Set db = Client.OpenDatabase("Sample-Detailed Sales.IMD")

' Delete the result named MyResult.

db.DeleteResultByName "MyResult"

' Clear the memory.

Set db = Nothing

End Sub

Smiso
Offline
Joined: 03/07/2019 - 03:05

Thank you very much Brian, this is working :)