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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

How to use the Dropdown widget?

Nate_145
7-Bedrock

How to use the Dropdown widget?

I am trying to remotely load a program onto a robot by selecting the program from a dropdown menu and using a button to load that program (see below). I need to pass the program name (string) and starting position (6 numbers) to a service that commands the robot to move to the starting position and ready the program for execution. However, I have thus far been unfruitful in getting the data from the selection made in the dropdown widget. 

 

NS_YSmartLab_1-1626282749736.png

 

I have been able to feed data from an infotable created as a property of a Thing to the dropdown widget and display the program names in the dropdown. I have tried to access the data from the selected item in the dropdown through myThing > GetPropertyValues > ReturnedData > SelectedRow(s) > myInfotable > SelectedRow(s) > ProgramName and StartingPositionVals (see below) but have not seen any data returned through that route when I check the mashup preview debug menu. I have tried using the SelectedRowsChanged event in that same location to execute my LoadProgram service, but without the necessary input values that service cannot run.

 

NS_YSmartLab_3-1626283721997.png

 

How do I access the data from the selection of a dropdown widget? 

Is there an example mashup I could look at to get an idea of how to connect things?

Is there a tutorial on how to set up the dropdown widget?

1 ACCEPTED SOLUTION

Accepted Solutions
PaiChung
22-Sapphire I
(To:Nate_145)

GetPropertyValues/Infotable property might not behave quite right for you, I would suggest a Service that creates the infotable that you have currently as a property as its output.

So your own custom service, vs the GetPropertyValues.

View solution in original post

2 REPLIES 2
PaiChung
22-Sapphire I
(To:Nate_145)

GetPropertyValues/Infotable property might not behave quite right for you, I would suggest a Service that creates the infotable that you have currently as a property as its output.

So your own custom service, vs the GetPropertyValues.

Wonderful, between this and referencing the selected rows of the created service the problem is solved. 

 

For anyone's future reference to get a dropdown widget to function using a static infotable:

- Make a datashape with your needed field definitions

- Create a service that builds an infotable using the snippets "Create infotable from Datashape"

- Populate the infotable using the snippets "Create Infotable Entry from Datashape" or followed by "AddRow(Object)"

- In the mashup you're using the dropdown in, add the service you created in the data panel

- Connect the Returned Data -> All Data to the Data input of the dropdown and define the display field

- Connect the Returned Data -> Selected Row(s) -> variables to any targeted services from the selection in the dropdown

- Use the SelectedRowsChanged event (or a custom event like a button press) to launch the targeted service

Top Tags