Reset Column Selector Values

Hi Everyone,

I hope all are well. I have one requirement in Column Selector. I have 180 columns containing tables and I'm using that Column Selector to hide 110 columns and show 80 columns as default. I have given one confirm button once I select or unselect the columns in the column selector click that button to apply the changes on the CS. And now my new requirement is Just I need to add one button named "Reset". If I deselect a few columns from the default 80 columns and click the confirm button those columns are hidden. Then if I click the reset button, That column selector becomes as Default stage My default 80 should need to be shown in the Column Selector. Could you please help to achieve my requirements?

Thanks & Regards,
Muniyandi D

Hi Everyone,

Sorry for looping you all in this Chat, I hope all of you as well. I had some doubts about ignition vision component scripting using SDK scripting in the Colunm selector component. I have tried in multiple ways but no one Works well. Previously I see one chat but the need is to select or deselect all values, but my requirement is slightly different from that topic. I have given my requirements below.

Now I use a column selector component to manage some columns in the dataset and I use that to table. My table's dataset column count is 194 and I should need to show 81 columns as default. If the client opens this window only 81 column values are shown in the table. and other columns should be disabled in the column selector component.

If the Client wants to see more columns, they should select the columns they want. After client selection, 90 columns will appear. Now they need to see the default 81 columns, so I gave one reset button below the column selector when the client clicks the button, automatically 81 columns should be selected in the column selector component and the Data_out property of the column selector component.

Could you please anyone can help me to achieve my requirements as soon as possible?

My error script

import java.util.ArrayList
import java.util.List
import com.inductiveautomation.factorypmi.plugins.reporting.components.columnselector.DataSetConfig
from com.inductiveautomation.factorypmi.plugins.reporting.components.columnselector import ColumnFilteredDataSet, DataSetConfig
from com.inductiveautomation.factorypmi.plugins.reporting.components.columnselector import DataSetConfig

column_selector = event.source.parent.getComponent('Column Selector')

ColumnFilteredDataSet.setColumnFiltered("Substrate ID", False)

While using this Script, I got an argument and self-arg data error,
argument error :

File "event:mouseClicked", line 49, in
TypeError: setColumnFiltered(): expected 3 args; got 2

self-arg data error:

self arg can't be coerced to com.inductiveautomation.factorypmi.plugins.reporting.components.columnselector.DataSetConfig

Thanks & Regards,
Muniyandi D

  1. You already replied in an existing thread.
  2. You didn't format your code, use this
    image
  3. No need to tag Phil Turmel, he reads every thread on the forum

Sorry @Matrix_Engineering for my inconvenience in activities of 1 and 3 lines in your commend.
I removed Phil from my Thread. But I didn't get 2nd one. Can you please explain that 2nd one Briefly?

Thanks & Regards,
Muniyandi D

Read this, it's all explained there:

Now I understand @pascal.fragnoud . And now I have edited my thread. Can you please check now ?

This too, please

Is that your full code, because it looks just like imports, not actual CS code.

Your error message says line 49, please post at least 49 lines of code.

Also, it is telling you that you have supplied 2 args, but the function expects 3.

Now I added that too...

And I had put that script in Button.

I hadn't used this SDK scripting before. For now, this is my last option to achieve my requirements. On the SDK page, they have mentioned only 2 inputs for "setColumnFiltered" function. that's why I give only two inputs. But I don't what was the 3rd arg. But, I gives the Column Selector component's path into this function it throws an error like.,

self-arg data error:

self arg can't be coerced to com.inductiveautomation.factorypmi.plugins.reporting.components.columnselector.DataSetConfig

This is not legal in jython nor in java. You are calling an instance method on a class definition.

setColumnFiltered() is method, not a function. You need an instance of that type to use that method.

If column_selector is that type, then you would do:

column_selector.setColumnFiltered(....)

( I haven't looked closely... )

Sorry @pturmel for i can't able to catch what are you saying. Can you explain it with an example?

Thanks & Regards
Muniyandi D

You still haven't posted your entire code.

Why is this an onMouseClick event?

Phil is the better man for explaining the correct terminology of what you're doing wrong here. My background is mechatronics not pure code.

Post your entire code and someone can advise if there is a better, more succint way.

You are importing classes that the SDK implies you need, but that is not how you apply that information in most cases. Instead, the SDK tells you what you can do with an instance of that class when you get one in context, that is, from the event or extension function.

For example, the initialize() extension function gives you the Power Table itself as self, from which you can use the methods documented for the VisionAdvancedTable.

In events, you usually get the component from event.source, after which you drill in (with methods and properties) to the instance you care about, then use its methods to make adjustments.

FWIW, I would be manipulating the Column Attributes Dataset of the table to hide columns, not trying to mess with the table's implementation details (which will keep getting reset on data changes).