Jump to content

Looking for information on how to get started using IronPython


Ming Qian

Recommended Posts

Hi @Ming Qian​ we have an extensive section with scripts here: https://community.spotfire.com/s/article/IronPython-Scripting-in-TIBCO-Spotfire and we welcome input on what else you would like to see in that section. I will let others post some ideas on where you can learn IronPython. That's not really what the TIBCO Community provides but we can add some pointers to this thread for good public resources. What have you used yourself so far? Did you already complete any courses to learn IronPython or are you new to IronPython?

Link to comment
Share on other sites

Thanks @Heleen Snelting​!

To expand on this - IronPython is Python, but with extensions to be able to call C# API's. The Spotfire API is C#, so you can call most C# methods using IronPython. See the docs on the C# API here: https://docs.tibco.com/pub/doc_remote/sfire_dev/area/doc/api/TIB_sfire-analyst_api/Index.aspx

I would recommend using some of the examples that Heleen has pointed to you in order to learn how to use the API. I would also suggest that you post specific individual questions if you can't figure out how to do anything. I think previously you asked (for example), what

myVis = myVis.As[Visualization]()

means?

This is a useful test case to explain some concepts... In this case - I would say that this statement is unnecessary (explained below) - if you've copied it from an existing example, please let us know where it is and we can correct it... In general, we do need more context in order to be able to advise properly. A single line of code doesn't tell us enough about what you are trying to do and understand.

However... I presume that myVis is a parameter to the script. If you check the C# API, Visualization is the parent (base) class for all Spotfire visualization objects. A BarChart is a specialisation of the Visualization class.... The Spotfire parameters will always be the base class. The myVis will already be of Visualization type.

So if you need to operate on a bar chart for example, you would pass the bar chart object in as a parameter value, which would be of the type Visualization.

If you then needed to change the X axis of the bar chart, you would do something like this:

barChart = myVis.As[barchart]()barChart.XAxis.Expression = "[Year]"

The .As method returns a BarChart object, which you can then inspect or manipulate.

Thanks,

Andrew (TIBCO Data Science)

Link to comment
Share on other sites

Admin note:

Changed Title.

Old Title:

who can share how to study ironpython method due to less of study mateials not like python?

we can not how to use ironpython codes to express our idea, it is reason that we can know what the codes express but not konw the why backgroud. we need know why.

New Title:

Looking for information on how to get started using IronPython 

Link to comment
Share on other sites

hi, @Heleen Snelting​ 

Thanks for your help!!!

I am a new to study ironpython and use it in Spotfire to dispose data and get visualization Automatically.

for a new, I never study ironPython so far, and it is different from Python😅 ,so I feel it hard and need help.

Focus on some difficulty points in our actual work below:

1.     Data Table

a)     Insert/remove one or more columns in an existed dataTable;

b)     Insert/remove one or more rows in an existed dataTable;

c)     Select a certain table when already many data tables in Spotfire;

d)     Insert/remove one or more calculated columns, and save in source table or save as a new table;

e)     Sort by one or more columns;

f)      Select a certain page when many pages existed in Spotfire;

g)     Combine several tables and save as a new table for visualization later;

h) Add 3 calculated columns to dispose get year, month, week from date time column;

i) Add a calculated column to split string from a certain column, such as “A0001-product” to get “A0001” in a new column.

2.     CrossTable

a)   Select one or more columns to do a crossTable;

b)   Refresh crossTable.

3.     Visualization

a)     Load a chart such as barchar, scatterplot, boxplot, hotmap, lineplot and so on; how to express by codes;

b)     Select some certain columns in an existed table to do a chart;

c)     Different types of graphs in one page, how to select a certain chart to modify;

d)     Export visualization to PPTx and save to local, especially many slides to one pptx;

e)     Timely refresh a chart when refresh dataTable such as add new rows or replace old table with new dataTable.

Link articles shows many ironpython code, but no more detailed explanation so that can’t study further. Whether have some codes that it may be sample not complicated but it is a complete code to express author's thoughts and reason/method of use. it is reason that some example codes can not run in spotfire but it is difficult to find reason😅 .

Thanks so much!

Link to comment
Share on other sites

Hi @Ming Qian​ please review Andrew Berridge's response below (from Friday). He explains how IronPython works and suggests some documentation to review. You'll have to study this before you can effectively use the IronPython scripts with Spotfire and understand them and troubleshoot them. Maybe work through some of the examples one by one. Most of what you list that you want to do is in the scripts provided. Once you have studied the documentation, you'll need to peruse the examples and extract snippets of code from them.

If you have a specific question we are happy to help you but the extent of your request above is likely beyond what our community members have time for. If your work is urgent and you would like some help from a TIBCO partner you can indicate that in this thread and we can match you up with someone. Good luck, many Spotfire users use IronPython so it is worth studying it!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...