本文介绍了如何使用 x++ 从字符串字段自动填充查找字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 d365 Finance and Operations 的新员工

我有一个表单和字段.每次我输入这些字段之一的新记录时,它们的值都应连接起来,并将组合文本放入详细信息"字段.2 个字段是字符串,我为它们使用 Modified 事件,但另一个字段是查找.如何将查找字段中的名称"字段写入详细信息"字段?如果有人帮助我,我将不胜感激.

这是我的字符串字段代码;

[FormDataFieldEventHandler(formDataFieldStr(InventSite, InventSite, Field1), FormDataFieldEventType::Modified),FormDataFieldEventHandler(formDataFieldStr(InventSite, InventSite, Field2), FormDataFieldEventType::Modified)]public static void Field1_OnModified(FormDataObject sender, FormDataFieldEventArgs e){//获取表单数据源FormDataSource 数据源 = sender.datasource();//获取当前记录InventSiteinventSite = dataSource.cursor();//连接字符串值str 详细信息 = strFmt(%1, %2",inventSite.Field1,inventSite.Field2);

这是我的查找字段.非常感谢您提前...我的查找字段

如果我需要解释得更清楚,我想要获取的值在引用组中(类型:int64)我需要获取它的'name(控件名称)'值,并且像其他人一样(field1和field2,我需要在详细信息"字段中自动写入它.请帮助...

解决方案

为您的 LookupTable 创建静态 findByRecId 方法(如果它是标准表,请使用类扩展).然后修改你的代码:

[FormDataFieldEventHandler(formDataFieldStr(InventSite, InventSite, Field1), FormDataFieldEventType::Modified),FormDataFieldEventHandler(formDataFieldStr(InventSite, InventSite, Field2), FormDataFieldEventType::Modified)FormDataFieldEventHandler(formDataFieldStr(InventSite, InventSite, Field3), FormDataFieldEventType::Modified)]public static void Field1_OnModified(FormDataObject sender, FormDataFieldEventArgs e){//获取表单数据源FormDataSource 数据源 = sender.datasource();//获取当前记录InventSiteinventSite = dataSource.cursor();//连接字符串值str details = strFmt("%1, %2, %3",inventSite.Field1,inventSite.Field2,LookupTable::findByRecId(inventSite.Field3).Name);

I am new at d365 Finance and Operations

I have a form and fields in it. Every time I enter a new record of one of these fields, their values should be concatenated and the combined text put to the 'Details' field. 2 fields are string and I use Modified events for them but the other field is lookup. How can I get the 'name' field in the lookup field to be written to the 'details' field? If anyone helps me with this I would be really appreciated it.

Here is my code for string fields;

[
    FormDataFieldEventHandler(formDataFieldStr(InventSite, InventSite, Field1), FormDataFieldEventType::Modified),
    FormDataFieldEventHandler(formDataFieldStr(InventSite, InventSite, Field2), FormDataFieldEventType::Modified)

]
public static void Field1_OnModified(FormDataObject sender, FormDataFieldEventArgs e)
    {
        // get the form DataSource
        FormDataSource dataSource = sender.datasource();

        // get current record
        InventSite inventSite = dataSource.cursor();



        // contatenate string values
        str details = strFmt("%1, %2",  inventSite.Field1, inventSite.Field2);

And here is my lookup field. Thank you very much in advance...My lookup field

If I need to explain more clearly, the value that I want to get is in the reference group (type: int64) I need to get its 'name(control name)' value, and Like others (field1 and field2, I need it to be written automatically in the 'details' field. please help...

解决方案

Create static findByRecId method for your LookupTable (use class extension if it's a standard table).Then modify your code:

[
    FormDataFieldEventHandler(formDataFieldStr(InventSite, InventSite, Field1), FormDataFieldEventType::Modified),
    FormDataFieldEventHandler(formDataFieldStr(InventSite, InventSite, Field2), FormDataFieldEventType::Modified)
    FormDataFieldEventHandler(formDataFieldStr(InventSite, InventSite, Field3), FormDataFieldEventType::Modified)
]
public static void Field1_OnModified(FormDataObject sender, FormDataFieldEventArgs e)
    {
        // get the form DataSource
        FormDataSource dataSource = sender.datasource();

        // get current record
        InventSite inventSite = dataSource.cursor();

        // contatenate string values
        str details = strFmt("%1, %2, %3",  inventSite.Field1, inventSite.Field2, LookupTable::findByRecId(inventSite.Field3).Name);

这篇关于如何使用 x++ 从字符串字段自动填充查找字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 15:22