Skip to main content
12-Amethyst
October 11, 2019
Question

Change media sourceURL based on thing property

  • October 11, 2019
  • 1 reply
  • 791 views

Hello,

 

I want to change the sourceURL based on a thing property.
Currently I have an expression (see below) that has the input of a thing.getpropertyvalues and the output of a string connected to the media sourceURL property. Please see pictures below. 

 

I have verified that the input property is accessible and changes (0 or 1).

Using: ThingWorx 8.4.2-b2151

 

switch (URL) {
case 1:
return "/Thingworx/MediaEntities/GridLeft";
break;
case 0:
return "/Thingworx/MediaEntities/GridRight";
break;
}image.pngimage.png

 

 

1 reply

18-Opal
October 13, 2019

Hello,

 

Try it like this:

switch (URL) {
 case 1:
 result = "/Thingworx/MediaEntities/GridLeft";
 break;
 case 0:
 result = "/Thingworx/MediaEntities/GridRight";
 break;
}

 

/ Constantine