Select field from SQL Datasource in Google App Maker based on drop down value

╄→尐↘猪︶ㄣ 提交于 2020-03-05 02:01:58

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!