在D365表单开发中,我喜欢获取输入到表单控件中的值,表单控件是一个带有Party引用字段的表单引用组控件。
如何获取输入到控件的值?
尝试过:
ReferenceGroup.controlNum(i).valueStr();
FieldBinding 与 filterValue
两者也不行。
在D365表单开发中,我喜欢获取输入到表单控件中的值,表单控件是一个带有Party引用字段的表单引用组控件。
如何获取输入到控件的值?
尝试过:
ReferenceGroup.controlNum(i).valueStr();
FieldBinding 与 filterValue
两者也不行。
它应该像在 FormReferenceGroupControl 对象上调用 value() 方法以获取底层引用值(int64) 一样简单,该值是底层数据源的 RecId。例如:
FormReferenceGroupControl referenceGroupControl;
referenceGroupControl = element.control(element.controlId(formControlStr(ReferenceGroupTestingForm, ReviewHeaderInfo_CustomsRepRefGroup))) as FormReferenceGroupControl;
referenceGroupControl.value(); //returns the RecId of the DirPerson table displayed.
要获取替换给用户的Display 值,而不是存储在数据库中的基础 RecId 值,请执行以下操作:
FormReferenceGroupControl referenceGroupControl;
referenceGroupControl = element.control(element.controlId(formControlStr(ReferenceGroupTestingForm, ReviewHeaderInfo_CustomsRepRefGroup))) as FormReferenceGroupControl;
//this gets the string control that is substituted in for the reference value/recid and displayed to the user. This is the second underlined control in the picture below. This control is determined by the ReferenceGroupControl property "Replacement Field Group"
//Could be a different type of control than a String control depending on your scenario
FormStringControl subStringControl = referenceGroupControl.controlNum(1) as FormStringControl;
subStringControl.text(); //for string controls, text will contain the display value
最后要注意的一件事是,我相信可以通过操作数据源对象而不是 formcontrol 对象来获取值。我过去在搜索谷歌搜索结果时看到过这样的解决方案。如果我再次遇到他们,我会更新答案