Dear Gurus,
Need help here ( I am a total Newbie here exploring ignition and just completed IU Lessons )
- I Have a page intended to be used as Component , in Page Props I here have Prop named "Table" , this page just have one Table Component whose data databinding is set the the abovementioned Prop
- I have a second page where I have a simple table and want to pass the Page Table data to the step 1 Component Table.
I have passed the data as toDataSet({../Table.props.data}) as well as {../Table.props.data} in second attempt.
how do I achieve this, my current flow passes extra not needed data to the component table as shown in the picture. please help. ( the top table is the table on component page and I am trying to pass data from the bottom table to the component page )
We need to fix some terminology here. I think this is what you mean:
- I Have a
page view intended to be used as Component in an embedded view. , in Page Props I here have Prop named "Table" , In this view I have a view parameter named "Table". This pageview just has one table component whose data binding is set the the above-mentioned Prop parameter.
- I have a second
page view where I have a simple table and want to pass the Page table data to the step 1 table component.
A page is a collection of one or more views and is created in the Page Configuration section of Designer.
I'm not quite sure what you are trying to do but I think you can do what you want if you create a custom property on the main view. Bind both tables to that custom property. The one that needs to write to that custom property needs to have bidirectional enabled.
This method creates a kind of global variable that is available to all components (including embedded views) inside the main view.
2 Likes
yes pardon for my terminology but you have put it exact what I mean to convey.
This is my current setup
I want to pass the data of TestPage "Table" to SaveToExcel view "Table" ( which finally will be removed and only "Save_Excel" will be there)
On SaveToExcel view I have PARAMS as
and on Table at "SaveToExcel" View I have set binding as
the Table at "TestPage" View don't have any bindings and just a plain table dragged from Components.
the embeddedview in "TestPage" has following props setup
the 'Table' in that prop has binding as
Hope this clarify my question.
changing binding to {../Table.props.data} from toDataSet({../Table.props.data}) solved my issue.
thank you for letting me know the right terminology though @Transistor , appreciated.
I don't see the need for toDataSet
as the data required by SaveToExcel.Table.data will be exactly the same as TestPage.Table.data. (I see you realised this as I was typing this post.)
In any case, a better solution is to use message handlers. When Save_Excel
button is pressed it should send a message to TestPage.Table and get it to save the data (since it already has it).
- Right click on the button.
- Configure Events, onActionPerformed, +, Script and add the following code:
system.perspective.sendMessage("SaveExcel", {}, "page")
https://docs.inductiveautomation.com/display/DOC81/system.perspective.sendMessage
Now you need to create a message handler on TestPage.Table
.
- Right click on the table.
- Configure Scripts, Message Handler, + Add Handler, Message Type = SaveExcel, Listen Scope = Page.
- In the Script section add in the code to save the data.
The big advantage with this is that it will still work if you move stuff around or wrap the table in a container, etc., - all things which can break your application otherwise as the relative paths don't update automatically.
https://docs.inductiveautomation.com/display/DOC81/Component+Message+Handlers
1 Like
Hello @Transistor ,
Thank you so much for your suggestion. I might sound silly but please forgive as I am a newbie in Ignition.
I might have more than 10-15 Tables(in multiple views) which needs to have "Save to Excel" button Functionality so was trying to make it a dynamic button so just Drag and drop the "Save To Excel" View and configure two paramaters ( TableData and SheetName )
According to your suggestion I have to go-to every table and configure a Message Handler in all the tables, for my scenario instead of having a button on Every Table with the code to save to excel I was trying to achieve it dynamically. any other suggestion you might have in my case ? May be passing the table name instead of table data sounds good ?
Thank you and Regards.
Well then put a button on each view, have the button call a gateway script and pass Table.data
into the gateway script.
But why not have just one view with a table and button and switch the table contents as required?
1 Like
The best way to solve my problem is this way, and I will learn how to achieve this Thanks
This don't work for me as multiple tables have multiple view with their own filters and other buttons.
Thank you for your support @Transistor , Appreciated.