-->

How to make invisible the lookup field?

2019-08-17 01:34发布

问题:

I want to take a value from lookup field. But I neet to make invisible this field. My code is this:

public void lookup()
{    
    Query query = new Query();
    QueryBuildDataSource queryBuildDataSource;
    QueryBuildRange queryBuildRange;    
    SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(MYTable), this);    
    sysTableLookup.addLookupField(fieldNum(MYTable, FieldTableA));
    sysTableLookup.addLookupField(fieldNum(MYTable, FieldTableB));
    sysTableLookup.addLookupField(fieldNum(MYTable, RecId), true);    
    queryBuildDataSource = query.addDataSource(tableNum(MYTable));    
    sysTableLookup.parmQuery(query);    
    sysTableLookup.performFormLookup();
}

So, I need to populate the field with RecID, but I don't want to see the RecId in my lookup.

It's possible?

Or, another question, It's possible to get two value for the same record, in my case to get the values from MyTable.FieldTableA and Mytable.FieldTableB?

回答1:

No this is not possible with the standard lookup as far as I can tell. You can see how it builds the dynamic lookup form here:

\Classes\SysTableLookupBase\buildGrid

You can make your own custom lookup form.



回答2:

After re-reading your question, what you want to do is common and base functionality.

It's called using Referenced Data Sources. See below:

https://msdn.microsoft.com/en-us/library/gg845085.aspx

You can look how addresses (LogisticsPostalAddress) are stored on objects, such as SalesTable to see.