Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
Hi all,
I have a drop down widget that displays 3 items. These 3 items are defined in a data shape. Users will be required to select one of the 3 items from my main mashup via the navigation widget, which leads me to 3 individual mashups.
However I am figuring out how the code should be done.
I took reference from https://community.ptc.com/t5/ThingWorx-Developers/Navigation-to-mashup-based-on-input/m-p/616663
Prior to that, I have binded my Name of my field defintions-data shape to my service-input parameter, Name
This is my code with Input being a Name(string), and Output result(Mashup Name).
if (name == "Item_1")
{
var result = Mashups["Item_1Mashup"].GetResult();
} else if (name=="Item_2")
{
var result= Mashups["Item_2Mashup"].GetResult();
}
else if (name=="Item_3")
{
var result=Mashups["Item_3Mashup"].GetResult();
}
The error shows "Error executing service queryFORM. Message :: TypeError: Cannot find function GetResult in object com.thingworx.ux.mashups.Mashup@3cfea923. - See Script Error Log for more details."
Help is deeply appreciated. Thank you for looking.
Solved! Go to Solution.
Hello @imsuneaik ,
You don't need a service for that, just use "Item_1Mashup" as item names (instead of "Item_1") and bind the value from Selected Rows directly to you Navigation widget.
Alternatively, if you can't change those item names, you can append "Mashup" to them using an Expression widget.
/ Constantine
What you need to return and bind to the Navigation widget is the name of the mashup.
(BTW You could use a Menu and GetEffectiveMenu and then use SelectedRow)
Your approach
if [your input paramter] {
result = NameOfMashup
}
Consider using a Switch statement so you can also have a default nav defined so Users aren't confused if they select and no navigation happened.
You can also directly generate the name with name of mashup in an infotable and then when they make the selection you can use the selectedrow (similar to the Menu example)
Hello @imsuneaik ,
You don't need a service for that, just use "Item_1Mashup" as item names (instead of "Item_1") and bind the value from Selected Rows directly to you Navigation widget.
Alternatively, if you can't change those item names, you can append "Mashup" to them using an Expression widget.
/ Constantine