【问题标题】:Axapta: Lookup field display the string value instead of the ID?Axapta:查找字段显示字符串值而不是 ID?
【发布时间】:2009-11-11 17:15:57
【问题描述】:

当 AX 生成表单和网格时,所有查找都会正确填充,但查找项的 ID 会显示在表单中。查看有意义的值的唯一方法是单击该字段——这并不理想。有没有办法在表单中显示查找值而不是后面的id号?

我希望“tableB”表单显示 tableA_value 而不是 tableA_id。

表A

  • tableA_id(int - 唯一)
  • tableA_value(字符串 - 非唯一)

表B

  • tableB_id(int - 唯一)
  • tableA_id(int - 与 tableA 的关系)
  • tableB_datafields(杂项)

谢谢

【问题讨论】:

    标签: lookup axapta


    【解决方案1】:

    找不到更改查找本身值的方法,因此我在其旁边放置了一个静态字段,该字段会在查找更改时更新。以下是我最终的做法:

    表A的显示方法:

    display [datatype] lookupName(tableA _tableA)
    {
        ;
        return tableB::find(_tableA.[tableA id column]).[tableB string column];
    }
    

    在表 B 上查找方法:

    static tableB find([datatype] [lookup variable], boolean _forUpdate = false,
     ConcurrencyModel _concurrencyModel = ConcurrencyModel::Auto)
    {
    [TableB] [tableB];
    
    if ([lookup variable])
    {
        if (_forUpdate)
        {
            tableB.selectForUpdate(_forUpdate);
            if (_concurrencyModel != ConcurrencyModel::Auto)
            {
                tableB.concurrencyModel(_concurrencyModel);
            }
        }
    
        select firstonly tableB
            where tableB.[lookup column] == [lookup variable];
    }
    return tableB;
    

    }

    添加了表 A 和 B 作为表单的数据源。

    在表单中添加了一个字符串字段。

    将表 A 设置为字段的 DataSource,将 lookupName 设置为 DataMethod。

    在查找字段中添加了修改方法以使静态字段更新:

    element.redraw();
    

    希望这对某人有所帮助。

    【讨论】:

      猜你喜欢
      • 2013-06-08
      • 2020-02-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-03
      • 2021-07-11
      • 1970-01-01
      相关资源
      最近更新 更多