根据下拉值从Google App Maker的SQL数据源中选择字段 [英] Select field from SQL Datasource in Google App Maker based on drop down value
问题描述
我遇到一个问题,其中有3个SQL数据源(Employee
,Course
,Overview
).
I am running into an issue where I have 3 SQL Datasources (Employee
, Course
, Overview
).
我创建了一个从Overview Datasource
继承的页面,在这里我创建了一个下拉列表(基于Employee Datasource
Employee.items.Name._equals的选项,值设置为Overview.Item.Name ).当我在下拉菜单中选择他的名字时,我想动态填写一个文本字段,它会根据下拉菜单中的人员选择从Employee Datasource
中选择电子邮件字段.
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.
推荐答案
根据您的评论更改以下项目.
Based on your comment change the following items around.
概述数据源"下拉选项:
Overview Datasource dropdown options:
@datasources.Employee.items
暂时将您的下拉菜单值保持不变.
Leave your dropdown value the same for now.
下降onValueChange事件:
Dropdown onValueChange event:
widget.root.descendants.EmailTextBox.value = newValue.Email;
观察到newValue是小部件API中的一个内置变量,用于下拉菜单,并指向options数据源的对象,因此,如果您的选项是@ datasources.Employee.items,则options是组成对象的数组列出所有Employee项,然后选择一个选项时,它指向items [index],然后可以使用对象项的名称在index处调用对象.因此newValue.Email应该会获得所选的Employee电子邮件.
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.
这篇关于根据下拉值从Google App Maker的SQL数据源中选择字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!