Hi,

Here is one such example where you can create custom lookups on a dialog. I
have copied the methods of the class i had created:

*Class declaration:*

class SamSelectiveLookup extends RunBase
{
    FormStringControl   custGroupCtrl, customerCtrl;
}

*//Lookup method for control*

void Customer_lookup()
{
    Query                   query          = new Query();
    SysTableLookup          sysTableLookup =
SysTableLookup::newParameters(tableNum(custTable), customerCtrl);
    ;

    sysTableLookup.addLookupField(fieldNum(custTable, accountNum));
    sysTableLookup.addLookupField(fieldNum(custTable, name));

    query.addDataSource(tableNum(custTable)).addRange(fieldNum(CustTable,
CustGroup)).value(custGroupCtrl.text());

    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
}

protected Object dialog(Dialog dialog, boolean forceOnClient)
{
    DialogRunBase ret;

    ret = super(dialog, forceOnClient);

    custGroupCtrl = ret.formBuildDesign().addControl(FormControlType::String,
'CustGroup');
    custGroupCtrl.extendedDataType(103);

    customerCtrl = ret.formBuildDesign().addControl(FormControlType::String,
'Customer');
    customerCtrl.extendedDataType(99);

    return ret;
}


public void dialogPostRun(DialogRunbase dialog)
{
    ;
    super(dialog);

    dialog.dialogForm().formRun().controlMethodOverload(true);
    dialog.dialogForm().formRun().controlMethodOverloadObject(this);

    custGroupCtrl = dialog.dialogForm
().formRun().design().controlName('CustGroup');
    customerCtrl = dialog.dialogForm
().formRun().design().controlName('Customer');
}


public container pack()
{
    return conNull();
}

public boolean unpack(container packedClass)
{
    return true;
}

static void main(Args _args)
{
    SamSelectiveLookup test1 = new SamSelectiveLookup();
    ;

    if (test1.prompt())
    {
        test1.run();
    }
}
Regards,
Sumit


On 8/7/07, Agus Riyadi <[EMAIL PROTECTED]> wrote:
>
>   Hi,
>
> In this case, it is easier to use Form instead of Dialog class. You know
> how
> to override lookup method in the form control.
> Take this sample on how to build such dialog with form :
> Inventory Management > Periodic > BOM > Calculation.
>
> There are many others examples in standard Axapta as well.
>
> Regards,
>
> Agus
>
> On 8/6/07, Santosh Sharma <[EMAIL PROTECTED]<santoshheyu%40yahoo.co.in>>
> wrote:
> >
> > Hi ,
> > Thanks for ur suggestion. But I wanted a lookup which shall depend on
> the
> > value of another variable.For eg. I want to have a lookup of all the
> > customers which belong to a particular customer group and the customer
> group
> > will be returned by a method at runtime.
> >
> > Regards ,
> > Santosh Kumar Sharma.
> >
> > Sumit Loya <[EMAIL PROTECTED] <loya.sumit%40gmail.com> <loya.sumit%
> 40gmail.com>> wrote:
> > Hi you can use the EDT for having a lookup on the dialog field
> >
> > e.g.
> >
> > dialog.addField(typeId(CustAccount), "","");
> >
> > You can also have a look at class "Tutorial_RunbaseBatch" for this
> >
> > On 8/2/07, Santosh Sharma <[EMAIL PROTECTED]<santoshheyu%40yahoo.co.in>
> <santoshheyu%40yahoo.co.in>>
> > wrote:
> > >
> > > Dear All ,
> > >
> > > How can we apply lookup on dialog field ? Any suggestions ?
> > >
> > > Regards ,
> > >
> > > Santosh Kumar Sharma.
> > > [EMAIL PROTECTED] <santoshheyu%40yahoo.co.in> <santoshheyu%
> 40yahoo.co.in> <santoshheyu%
> > 40yahoo.co.in>
> > >
> > >
> > >
> > > ---------------------------------
> > > Get the freedom to save as many mails as you wish. Click here to know
> > how.
> > >
> > > [Non-text portions of this message have been removed]
> > >
> > >
> > >
> >
> > [Non-text portions of this message have been removed]
> >
> > ---------------------------------
> > Once upon a time there was 1 GB storage in your inbox. Click here for
> > happy ending.
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
>
> [Non-text portions of this message have been removed]
>
>  
>


[Non-text portions of this message have been removed]

Reply via email to