问题
I am running into an issue where I have 3 SQL Datasources (Employee
, Course
, Overview
).
I have created a page inherited from the Overview Datasource
, where i have created a drop down (options based on the Employee Datasource
Employee.items.Name._equals, value set to Overview.Item.Name). When i select his name in the drop down, I want to dynamically fill in a text field where it selects the email field from the Employee Datasource
based on the person selection in the drop-down.
Is this possible? If so, how do I proceed? If further information is required please feel free to ask.
回答1:
Based on your comment change the following items around.
Overview Datasource dropdown options:
@datasources.Employee.items
Leave your dropdown value the same for now.
Dropdown onValueChange event:
widget.root.descendants.EmailTextBox.value = newValue.Email;
Observe that the newValue is a built in variable in the widgets API for a dropdown and points to an object of the options datasource, therefore, if your options are @datasources.Employee.items the options are an array of objects that make up all the Employee items and when selecting one option it points to items[index] and then you are able to call your object at index with the name of your object item. So newValue.Email should get the selected Employee email.
来源:https://stackoverflow.com/questions/52187749/select-field-from-sql-datasource-in-google-app-maker-based-on-drop-down-value