如何使用来自多个数据源的字段创建查找? [英] How to create a lookup with fields from more than one datasource?

查看:83
本文介绍了如何使用来自多个数据源的字段创建查找?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在表单字段中创建动态查找,该动态查找应显示来自两个不同数据源的字段.我试图将其执行为:

I need to create Dynamic lookup in my form field which should display fields from two different datasources.. I am trying to perform it as:

  public void lookup()
  {

    query = new Query();
   sysTableLookup = SysTableLookup::newParameters(tableNum(smmBusRelTable), this);
  qbds = query.addDataSource(tablenum(smmBusRelTable));
 // qbds.addDataSource(tableNum(DirPartyTable));
 //qbds.relations(true);

sysTableLookup.parmQuery(query);   
sysTableLookup.addLookupField(fieldNum(smmBusRelTable, Busrelaccount));
//sysTableLookup.addLookupfield(fieldNum(DirPartyTable, Name));


 sysTableLookup.performFormLookup();
}

注释行是我试图执行的操作,以添加其他数据源.

Commented lines are the operation I am trying to perform to add different datasource.

推荐答案

据我所知SysTableLookup类不支持显示其他表中的字段. addLookup()方法不使用TableId,并假定所有字段都在查询的第一个数据源中.

As far as I know the SysTableLookup class does not support showing fields from other tables. The addLookup() method doesn't take a TableId and assumes all fields are in the first datasource of the query.

您可以编写自己的SysTableLookup版本,该版本支持引用各种表中的字段.一种更简单,更实用(且更便宜)的方法是在SmmBusRelTable上创建一种显示方法,以从DirPartyTable中获取名称(如果尚不存在),并将其用作查找中的字段.如果我没记错的话,可以支持主表上的显示方法.

You could write your own version of SysTableLookup that supports referencing fields from various tables. A simpler and more practical (and less expensive) approach might be to create a display method on SmmBusRelTable to fetch the name from DirPartyTable (if it doesn't already exists) and use that as a field in the lookup. Display methods on the main table are supported if I remember correctly.

取决于您要完成的工作,可能有更简单的方法.您可以将显示方法添加到SmmBusRelTable的自动查看表"字段组中,而不必重写lookup()方法.

Depending on what exactly you're trying to accomplish there might be an even simpler way. You could add the display method to the AutoLookup table field group of SmmBusRelTable and avoid having to override the lookup() method.

这篇关于如何使用来自多个数据源的字段创建查找?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆