如何从查询方法中选择RecId? [英] How to get RecId selected from lookup method?

查看:196
本文介绍了如何从查询方法中选择RecId?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从查找方法中选择RecId吗?

I want to get the RecId selected from lookup method?

StringEditLookup_ZipCode

public void lookup()
{
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;

SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(LogisticsAddressZipCode), this);

sysTableLookup.addLookupField(fieldNum(LogisticsAddressZipCode, ZipCode));
sysTableLookup.addLookupField(fieldNum(LogisticsAddressZipCode, City));

sysTableLookup.addSelectionField(fieldNum(LogisticsAddressZipCode, RecId));

queryBuildDataSource = query.addDataSource(tableNum(LogisticsAddressZipCode));

sysTableLookup.parmQuery(query);

sysTableLookup.performFormLookup();
//super();
}

modified方法中,我想阅读广告并使用 RecId .

In modified method I would want to get ad read and use the RecId taken.

我想用ZipCode值填充 StringEditLookup_ZipCode .

I want to populate the StringEditLookup_ZipCode with the ZipCode value.

可以使用RecID吗? LogisticsAddressZipCode 表未由ZipCode编制索引 为此,我需要使用RecID.

It's possible to take a RecID ? The LogisticsAddressZipCode Table is's not indexed by ZipCode for this I need to take the RecID.

有一种方法可以保存在全局变量中,或以某种方式保存在 lookup 方法中选择的recid或其他位置吗?

There is a way to save in a global variable or somehow recid selected in the lookup method or another point?

谢谢,

享受!

推荐答案

据我所知,SysTableLookup框架无法做到这一点.基本上,您希望您的查询返回两个值:ZipCodeRecId.但是该框架只能返回一个值.

As far as I know this cannot be done with the SysTableLookup Framework. Basically you want your lookup to return two values, the ZipCode and the RecId. But the framework can only return one value.

因此,您需要通过创建新的查找表单来实现自己的查找,而不是框架.然后,您可以从此表单中通过lookup方法检索所选记录.以下是一些代码,可让您了解lookup方法的外观:

So instead of the framework you will need to implement your own lookup by creating a new lookup form. From this form you can then retrieve the selected record in the lookup method. Here is some code to give you an idea how the lookup method could look like:

public void lookup()
{
    FormRun lookupFormRun;
    Args args;
    LogisticsAddressZipCode myLookupZipCode;

    args = new Args();
    args.name(formStr(MyNewLookupForm));
    lookupFormRun = classFactory.formRunClass(args);
    lookupFormRun.init();
    this.performFormLookup(lookupFormRun);
    lookupFormRun.wait();
    if (lookupFormRun.closedOk())
    {
        myLookupZipCode= formRun.docCursor();
    }
}

您可以在其中将myLookupZipCodeRecId保存到类变量中,然后在modified方法中使用它.

From there you can save the RecId of myLookupZipCode to a class variable and then later use it in the modified method.

还要查看查找表单返回一个以上的值以获取其他信息.

Also take a look at Lookup form returning more than one value for additional Information.

这篇关于如何从查询方法中选择RecId?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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