cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Get the selected row from a contained mashup

nlaffargue
7-Bedrock

Get the selected row from a contained mashup

Hi,

I have a mashup where I launch a service in order to get an infotable which contains data for a Tree Table I want to display.

The Tree Table will be displayed in a contained mashup (name coming from another service) as depending on some parameters I don't want to show the same columns and rendering. I have added to the contained mashups a "Tree" parameters which is my infotable binded to the result of my service.


My problem is that when a row is selected in the Tree Table, I don't know how to provide the selected row to the parent mashup. I need that selected row for other purposes.


Thanks in advance for your help.

ACCEPTED SOLUTION

Accepted Solutions

Hi Carles!

I think I found another solution by passing the primary key to the parent mashup and using an invisible dropdown list to select the row in the data.

Then I can use the selectedRow from the parent data directly.

https://www.dropbox.com/s/e0lzwp9pc3ugsrq/NicolasLaffargueSampleInnerSelectedRowV3.xml?dl=0

Best regards,

View solution in original post

15 REPLIES 15
AnnaAn
14-Alexandrite
(To:nlaffargue)

Dear Nicolas,

Regarding how to get the selectedRows from contained mashup, here is some steps you could follow and it should work:

1. in your contained mashup, create a Tree widget, and bind the necessary service to it, e.g., call GetDataTableEntries from a DataTable you created

2. in UserManagementSubsystem User Session Shape Settings section, add a new ThingShape "ts1" with only one property "selectedRows" with INFOTABLE type

3.bind the Selected Row(s) to the session's "selectedRows" parameter:

4. Likely, in your parent mashup, bind the selectedRows in session to the widget(e.g., you want to display the selectedRows in a Grid) :

5. view the mashup, you should see the Grid data change accordingly when the Tree table selected rows changed in the contained mashup.

Hope this helps,

Thanks,

Br,

Anna

I think you can do it without using Session Variables, you just add a parameter on the inner mashup with the values you want to return as selected row, and then you just need to bind selected rows values to Mashup Parameters, this will be cleaner than Session Variables and also you don't mess up Session Variables for just a Mashup.

Hi Carles,
Thanks for your suggestion. It is working when I want to return specific attributes to the parent mashup but in my case I would like to provide the full selected row as an infotable because it contains lots of attributes and I would like to avoid creating twenty mashup parameters.

I don't know exactly why (looks like a "bug") but I can display in the parent mashup the selected row in a grid but I can't bind specific attributes to widgets (no arrow available as you can see in the screenshot)

Capture.PNG

The only workaround I see should be to have a useless service which gets and returns the same infotable and call this service when a selected row is changed in the contained mashup... This way I will be able to bind attributes to my widgets.

AnnaAn
14-Alexandrite
(To:CarlesColl)

Dear Carles,

The reason I consider to use session is that in containedMashup when you want to create a parameter with type of INFOTABLE, it is only out-bounded, so I could not assign the Selected Row(s) to the mashup paramter hence to pass it to the parent mashup. If you have any idea how to implement that, I'm also curious to know how

In contained mashup, if I just add a mashup parameter with STRING, NUMBER,etc but not INFOTABLE, it's two way bound -- in-bound and out-bound, but for INFOTABLE it's only out-bound.

Br,

Anna

Hi,

I did a quick test, and if I understand well what you want to do it's totally feasible with your first approach. I've prepared a sample set of objects attached here to sample it: https://www.dropbox.com/s/mgbq2a1vlgvmcxj/NicolasLaffargueSampleInnerSelectedRow.xml?dl=0

Best Regards,

Carles.

qngo
12-Amethyst
(To:CarlesColl)

Hi, I have a question. How could you export the Model Tag (which is not tagged with "SampleInnerSelectedRow") in the same file ?

Magic

No man, it's just how it works, you can export entities with a Tag/ModelTag which doesn't exist on the destination system and it works

AnnaAn
14-Alexandrite
(To:CarlesColl)

Hi Carles,

I tested against the sample you provided, and it works perfectly. Thanks!

I think the reason I failed to bind Selected Row(s) service to the selectedRows mashup parameter is that I tried to directly drag the Selected Row(s) to the selectedRows parameter, but that's not allowed as they are both out-bound. But if I bind with configure the current entity icon when I focused on GetData(in your sample) binding is allowed. Although I dont understand why, but it did work with your way.

qngo
12-Amethyst
(To:AnnaAn)

Hi, if you click on the button Bindings in the list of properties of the mashup, then you can bind by dragging the Selected Row(s) from the service to the All Data which is in-bound.

AnnaAn
14-Alexandrite
(To:qngo)

Thanks for the tip and that's what I did just now by clicking the button either from mashup or from the GetData service.

But since the mashup parameter with INFOTABLE type only has a out-bound , it looks like it could only be the binding source and could not be the binding target, but actually its "All Data" is allowed to be bound as binding target. And you could only recognize that with the binding button.

Hi all,

Thanks Carles for the example but I still have my issue. Once the selectedRow is provided back to the parent mashup, I agree you can display it in a grid.

But in my case I would like to bind specific attributes of this selected row to "ValueDisplay" widgets and these bindings are not feasibles.

For example, based on what you have done, how can you bind selected "pk" and "value" to "ValueDisplay" widgets?

Thanks again for your help.

Ok,

Yes you are right, I think they should improve it, but if you want to do it now you will need some tricky technics, attached comes a sample ( I don't like it, but for now I think it's the only way ) https://www.dropbox.com/s/lfkss8gtwwd60yo/NicolasLaffargueSampleInnerSelectedRowV2.xml?dl=0

Best Regards,

Hi Carles!

I think I found another solution by passing the primary key to the parent mashup and using an invisible dropdown list to select the row in the data.

Then I can use the selectedRow from the parent data directly.

https://www.dropbox.com/s/e0lzwp9pc3ugsrq/NicolasLaffargueSampleInnerSelectedRowV3.xml?dl=0

Best regards,

AnnaAn
14-Alexandrite
(To:nlaffargue)

Dear Nicolas,

Great to hear your issue is resolved or have a workaround at least. This topic is more like a brainstorming since we could have different ways to solve one issue

At last, please do not forget mark a correct answer if any before we close this topic.

Thank you and have a nice day,

Br,

Anna

qngo
12-Amethyst
(To:AnnaAn)

Hello, actually, that's what Nicolas needs, an out-bounded mashup parameter InfoTable, from the ContainedMashup to the parent Mashup. So he assigned the SelectedRow from the service to the mashup parameter and then pass it to the parent mashup.

Announcements


Top Tags