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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

How to fill a list-widget with content depending on another list widget

tlichtenberger-
1-Newbie

How to fill a list-widget with content depending on another list widget

Hey everyone!

I am currently working on a mashup in which I have to list-widgets as shown below.

The first list-widget has two elements, for example: Ferrari and Porsche

Depending on which element is selected, the second list-widget should be filled with a pre-defined list of either Ferrari-car-tag or porsche-car-tags.

It is like a filter mechanism.

Is this even realizable and how?

Thank you as always for your help

Best regards,

Theresa

ACCEPTED SOLUTION

Accepted Solutions

Hello Theresa,

Here is how I solve the problem:

1. create a datashape with 2 fields: String and Infotable. The first String is for main brands like Ferrari, the infotable (holding Strings) is for sub-brands.

2. Create a Datatable based on the datashape and add values inside

3. Create a Mashup, import the Datatable - GetDataTableEntries service, bind All Data to first List, bind Selected Rows to second List

4. Choose related fields in different List widget

   

5. View mashup, it would work




View solution in original post

12 REPLIES 12

Hello Theresa,

Here is how I solve the problem:

1. create a datashape with 2 fields: String and Infotable. The first String is for main brands like Ferrari, the infotable (holding Strings) is for sub-brands.

2. Create a Datatable based on the datashape and add values inside

3. Create a Mashup, import the Datatable - GetDataTableEntries service, bind All Data to first List, bind Selected Rows to second List

4. Choose related fields in different List widget

   

5. View mashup, it would work




hey Ryan Yuan​,

first of all, thank you so much for your detailed answer!

I have one question left:

As you suggested, I have added a Data Table-Thing and am now trying to fill the data table with my static values:

I can add the Brands (ferrari and porsche) without problems, but how can I add the subbrands?

best regards,

Theresa

As you can see in the first picture, when I created the Datatable, firstly I created a datashape used in here.

The CarBrand is a String shaped property, it can hold Ferrari

The SubBrands is a Infotable shaped property, and it looks like the New Field part I just added. This Infotable is a little table that can holds a list of data, and you need to assign another Data Shape for this Infotable. In the Demo I showed you, the SubBrands field contains a Key field to hold numbers, and I put detailed versions inside.

This image I posted comes from AddDataTableEntries service (default) in the entity

The little Orange Button with Edit in the picture means this field is a Infotable shaped property, and you need to click to open and add data inside.

Got it!! Thank you so much!

My pleasure~

hey Ryan Yuan​,

concerning this topic: Is it also possible to somehow change the values inside of the subitems-infotable?

Because I have also added the location of the specific ferrari-cars and porsche-cars(subitems) by now. But as the location of the cars can change, I want to change the value in the infotable as well (because I have added them manually and not dynamically in a service).

This is how far I got in implementing my own service:

After the last line of code, I have to update the subitem-infotable with a new value but I do not know how to accomplish that.

I have seen a function called UpdateDataTableEntry(params), but I think this will not work out for me because I haven't instantiated a DataTable-Thing for the subitem-infotable. I hope you somehow understand what I mean.

Thank your so much in advance

Warmest regards,

Theresa

Hi Theresa,

You can run this service

The  CarBrand is the first layer Key word to focus the Subbrands infotable, and for Subbrands you can send in an infotable typed data.

Hello Ryan Yuan

Please let me know about "2.Create a Datatable based on the datashape and add values inside".

I could not find "Editing Infotable".

What shoud I check?

Thank you in advance.

Hi, it's actually in AddDataTableEntries service in Datatable entities. Clicking the Edit Button I marked you will find the Editing Infotable

Hello Ryan Yuan

I made it!

Thank you so much!!

Hi @zyuan1

I have to represent a similar kind of list in the mashup.I have a Datashape but have not used a datatable.Also, I am saving all my real time data in a Stream.

Please tell me the similar way how I can obtain a list of one field definition upon selecting another field in the dropdown list in the mashup.

 

 

 

 

Hi @PPrasad_IoT18

 

Sorry for the latency,

It's exactly the same method with the ones in DataTable, you just need to add the infotable property in the Datashape of your Stream will work.  There's not much difference between an infotable result derived from Stream or DataTable

Announcements


Top Tags