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

Bind widget to properties dynamically

fmanniti
9-Granite

Bind widget to properties dynamically

I have THINGs that will be created runtime by the user and these THINGs have some fixed properties and some others that will be created dynamically; the only thing those properties have in common is they are all NUMBER.

Now, I have a gadget with a widget inside (let's say a LED widget) which should be connected by one of those dynamics properties.

I cannot do it by composer since I don't know the properties in advance. My question is:

is there a way to bind properties to a widget by service?

So that I could make a gadget with a dropdown list and the value displaied changes according to what is selected by the list.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Also you can create a Inner Mashup which receives as parameter the Thing Name and the Property Name and acts accordingly.

I have the same use case you say and well tougth it's not a problem at all. Well at the end for me it's everything Dynamic, then almost never I bind to specific properties...

View solution in original post

7 REPLIES 7

Why don't you list Thing's properties on a DropDown List?

Also you can create a Inner Mashup which receives as parameter the Thing Name and the Property Name and acts accordingly.

I have the same use case you say and well tougth it's not a problem at all. Well at the end for me it's everything Dynamic, then almost never I bind to specific properties...

Thanks

It's what I needed

Just one more question, maybe you can help me.

I have my mashup so designed:

Leftside bar with the list of all THINGS, on the right my dashboard.

Now, let's say that, on my leftbar list I have those two things with the following properties (dynamically added)

ELEMENT_1 --> Properties: Bending, Temperature

ELEMENT_2 -->Properties: Flexion, Grade

now, on my widget I have a LED display and a dropdown menu which lists my properties. Let's say I select Bending for ELEMENT_1 and Flexion for ELEMENT_2.

What happens is that when I switch from ELEMENT_1 to ELEMENT_2 my widget doesn't keep in memory my previous choice for ELEMENT_2.

I mean:

I select Bending for ELEMENT_1 and LED display the bending value, then I switch to ELEMENT_2 and the LED display is empty, so I select Flexion and LED displays flexion values but, when I switch back to ELEMENT_1 it is still blank.

So, is there a way to "tell" my widget to 'memorize' the choice for each ELEMENT?

You will have to "memorize" on User Preferences or Session Variable and set SelectedValue on DropDown list on Mashup Load ( if it's different Mashup ) or Refresh ( if it's the same inner mashup )

Sorry, I don't really understand this last thing you said:

If on my dashboard I will have 10 gadget, it means I must have on user preferences 10 properties to "memorize" so that, anytime I close the mashup or refresh it I won't lose my selection.

I don't really understand how you mean to bind the selection in order to memorize it.

You said id, you will need 10 properties ( or an infotable ) to memorize user preferences.

Top Tags