Drop Down Selection from Table

Hey Team,

My project is coming along great, thanks to everyone’s help.

My question is how do I create a drop down to show selections from a selected row from a table?

I know that i can create them all in the options but was hoping to bind it together in order to make updates on the base table then it will show as an option and reduce upkeep.

I do not have any code to show but here is a pick of the table I would like to draw from.

Not certain I understand the question. If what you are asking is, how to use the Case Type values from the Case Type table as the options of a drop down. All you need is a binding on the props.options. Note that if you are pulling these from a database, then you will need a script transform to format the data as the drop down expects (e.g an Array of Objects).

https://docs.inductiveautomation.com/display/DOC81/Perspective+-+Dropdown

Would the table need to only pull that one column? Right now I have the entire table and wanted to use a specific one for the drop down info.

I see 2 tables on the image you provided, which is part of my confusion.

If you’re going use the same data in multiple components, consider using a custom property to hold the full dataset and then using bindings with script transforms on the components to show the data you want. This will minimize the number of queries you are running.

1 Like

Thank you for being patient with me, I really appreciate it.

I only want to use the drop down to pull the “Case Type” data into it.

I’m still struggling to understand what it is you’re trying to accomplish.

Use the dropdown to pull the “Case Type” into what?

With a little more detailed description of what you want, I can help you better, but I just don’t understand what it is you’re trying to accomplish and what it is you are struggling with.

This was your original question, but that question doesn’t really make a whole lot of since because, presumably, a row in a table will only have 1 “Case Type”. Thus I assume that what you really want is to populate a dropdown with the values from the “Case Type” column. However, it isn’t clear if that is all of the possible case types form a database table, or some subset which is select via some other means and is currently being displayed in another table on your view.

To populate a dropdown with data you will need a binding on the props.options and possibly a transform to put the data into the correct format for the component.