Jump to content

How to set the "Limit by:Filterd rows of Input parameter" in Data function Edit Parameters by IronPython Script


. . 17

Recommended Posts

Dear all

First I set the Input Parameter("Filtered rows") of Data Function manually.Then, "Input Columns" are set by the followingIronPyrhon Script .After running the script, Input Parameter("Filtered rows") is canceled.I think it's probably because the script only sets the columns.

I want to know how to set "columns" and "filtered rows" at the same time.

(IronPython Script)

forfunctionindataManager.DataFunctions:

iffunction.Name=="ANOVA":

dataFunction=function

#printdataFunction.Name

forinputsindataFunction.DataFunctionDefinition.InputParameters:

ifinputs.DisplayName=="AnovaTable":

printinputs.DisplayName

dataFunction.Inputs.SetInput(inputs,expression)

Link to comment
Share on other sites

Do you really need an Iron Python script to run the data function with different columns

You could set up the input columns within the data function using an expression.

For instance, you set up a text area with a multi-select list of columns that goes into a document property called e.g. selcols.

Then you choose the columns in input by choosing the Expression input handler, and selecting selcols from the available properties for columnlist. Spotfire will automatically buildthe following expression:

$map("[Yourdatatablename].[${selcols}]", ",")

it changes the columns dynamically andpreserves the filtering you chose.

Link to comment
Share on other sites

Dear Gaia.

Thank you very much for your answer.The reason for setting the columns in the IronPython script is as follows.

I am doing data analysis in a semiconductor-based factory. There are so many parameters. The number of parameters varies with the time period of the data. Therefore, we need to reconfigure the input columns of the data function using IronPython script. If I set the column to be used for analysis in the data function, but it is not included in the input, an error will occur. Also, since the rows to be used for analysis are set by filters, the filters need to be enabled as well.

The Spotfire file I created is shared and used for analysis; it needs to be made easier to operate for those who are not familiar with Spotfire. If I am using it alone, I don't need to worry about it so much.

There are three constructors for the SetInput method. Currently, I am using the one with two arguments. Can I solve my problem by using the one with three or four arguments

Link to comment
Share on other sites

I set "0"(zero) as the third argument of SetInput method as follows, I can set "Active filterring scheme". 

        dataFunction.Inputs.SetInput(inputs,expression,"0") I want to know how to set it to any filter scheme.

Link to comment
Share on other sites

Dear Gaia.

Thank you for your repeated answers.

Sorry. I did not understand what you were saying due to my lack of skills.

I am still unable to imagine what to do even after your additional comments. Since I can't share the real file due to my company's security rules, I would like to make a sample file to share. Please wait for a while.

Link to comment
Share on other sites

Dear Gaia.I share the sample file. I used the Baseball.txt data to create a sample file.

Data function name is ToolSortANOVA.  This issue is about setting up a filter for the input parameters of the data function.In the sample file I'm going to share, I've done this in the following way. Please see the IronPython  Script "MakeModelEquation" in Action Control Button named "MakeModelEquation" of right side text area of "DataRelationships page". 

 

              dataFunction.Inputs.SetInput(inputs,expression[:-1],"0") I use R libraries as follows in data function.

      (1) rpart to analyze regression modeling

      (2) rpart.plot and RinR to draw Regression TreeMy pc :

  OS: Windows10

  Spotfire Analyst version : 7.6

 

Spotfire Server:

  OS:Widnows Server 2012 R2

  Spotfire : 7.6

  TERR version:4.3.2

  R version:3.2.2

  R version for REvaluator: 3.6.2 

  Using TERR & R on Spotfire Server.

Link to comment
Share on other sites

The issue was solved by a modification of the suggested solution. The Iron Python script was still needed in this context, but it was modified to write a document property containing the expression to use as a dynamic input handler for the data table columns. This way any filters were preserve.
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...