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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Runtime Source URL property access of an Image widget

jserrano
1-Visitor

Runtime Source URL property access of an Image widget

Hi everyone,

I am trying to access to the "Source URL" property of an image widget through a Thing service without success. Any idea on how to acomplish this?

I think it would be the same way to access to any widget property.

Greetings.

7 REPLIES 7
Aanjan
12-Amethyst
(To:jserrano)

Josue, widget properties are generally locked down to the Mashup builder stage. You can't access them through services. What you can do is build services around them, and feed in those properties through your service output.

For example, the Image widget's SourceURL property requires a form of text input to select the right media entity, so you can bind a service that outputs text to it. Or you can bind a text box to the same property and type in the name of your existing media entity or maybe list the entire selection of media entities on a List widget and bind the selected rows here, so any time you select a row, the image would change.

jserrano
1-Visitor
(To:Aanjan)

Thanks Aanjan, your ideas might be helpful. I'll try them up and let you know if it worked for the purpouse Im looking to archive.

jserrano
1-Visitor
(To:Aanjan)

Aanjan,

I have implemented your ideas and they worked. Now I am facing another issue:

* Current implementation is for a set of 5 image widgets wich changes URL everytime an actions is performed (On/Off status); but I have developed a thing for each one of them. The issue is: Im I gonna have to create a thing for every one of a 1000 of image widgets we are planning to "control"?

Aanjan
12-Amethyst
(To:jserrano)

If they are just Media Entities, you wouldn't require a Thing. The REST call 'http://localhost:8080/Thingworx/MediaEntities/' (assuming port 8080) will display the list of images you have. You can type the name of your entity after /MediaEntities/ to directly get to that image (http://localhost:8080/Thingworx/MediaEntities/AcknowledgeAlertIcon).

jserrano
1-Visitor
(To:Aanjan)

I thing I did not explained myself clear Aanjan:

I have an arrange of MediaEntites wich will be changing from Green to Red every time an action is performed (i.e. when a user is authenticated, one of thoose MediaEntities will go green and then, after few seconds will go Red).

What we will be developing is a "Dashboard" for the security area who will be monitoring access for many areas in an office/school, and I'm trying to figure out how to deal with this "control" functions.

Aanjan
12-Amethyst
(To:jserrano)

Have you tried using State-based Formatting for this? As a simple test, try this -

  1. Add a Value Display widget and a Text box widget to a Mashup.
  2. Bind the Textbox's 'Text' to the Value Display widget's 'Data'.
  3. Click on the Value Display widget and then click on the selection for ValueFormat in your property pane on the bottom left.
  4. Click on State-based Formatting
  5. Choose Text as the Dependent Field and for State Definition, choose StatusState (one of the default states)

Now you should see states like Available, Offline, Error as the states. Hit done and view your Mashup. If you type AVAILABLE into the textbox, you should automatically a green circle appear with the word AVAILABLE; same applies for other states like ERROR.

If this seems applicable to your use case, you can create a State Definition that would align more towards your design.

jserrano
1-Visitor
(To:Aanjan)

That was the solution I've been looking for. I really apreciate your time and support.

Gretting from Mexico

Announcements


Top Tags