This post is machine-translated. The original post in german language can be found here.

Create lookup for simple unbound stringcontrol

The following code is intended to demonstrate how to add lookup functionality to a data-unbound StringControl.

[Control("String")]
class FormStringControl1
{
    public void lookup()
    {
        //super();
        SysTableLookup systableLookup =
            SysTableLookup::newParameters(tableNum(CustGroup), this);

        systableLookup.addLookupfield(fieldNum(CustGroup, CustGroup), true);
        systableLookup.addLookupfield(fieldNum(CustGroup, Name), false);
        systableLookup.performFormLookup();
    }
}

The next example is an extension of the above, but now a query is used to limit the values ??to be displayed.

[Control("String")]
class FormStringControl1
{
    public void lookup()
    {
        //super();
        SysTableLookup systableLookup =
            SysTableLookup::newParameters(tableNum(CustGroup), this);
        Query query;

        query = new Query();
        query.addDataSource(tableNum(CustGroup));

        query.dataSourceTable(tableNum(CustGroup)).addRange(
            fieldNum(CustGroup, CustGroup)).value("??");
        systableLookup.parmQuery(query);

        systableLookup.addLookupfield(fieldNum(CustGroup, CustGroup), true);
        systableLookup.addLookupfield(fieldNum(CustGroup, Name), false);

        systableLookup.performFormLookup();
    }
}

 

 

These post applies to following version:
Dynamics 365 for Finance and Operations

Add comment
 
 

 

 
 
 
Posts of the actual month
Dezember 2024
MoTuWeThFrSaSu
 1
2345678
9101112131415
16171819202122
23242526272829
3031 
 
© 2006-2024 Heinz Schweda | Imprint | Contact | German version | Mobile version
In order to provide you with better service, this site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies.