Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

Default dimension business unit dialog form lookup with range

(0) ShareShare
ReportReport
Posted on by

Hi For BankAccountTrans there is a relation defualt dimension , now i am using a query names (CashBook) pastedimage1682053567848v1.png

and given relation as well , but dont know howto create lookup for business unit as well as i have to give range in this query for business unit as well . i already have created a dialog for bankaccount code , can i create lookup for business unit using these methods ..please help

 query buildQuery()
    {
       
        QueryBuildDataSource	qbdsBankAccountTable, qbdsBankAccountTrans;
        Query query				= new Query(queryStr(CashBook));
        qbdsBankAccountTable    = query.dataSourceTable(tableNum(BankAccountTable));
        qbdsBankAccountTrans	= query.dataSourceTable(tableNum(BankAccountTrans));
        
        qbdsBankaccountTrans.addRange(fieldNum(BankAccountTrans, TransDate)).value(queryRange(fromDate, toDate));

        //Bank Code
        BankAcc = con2Str(BankAccCon);

        if(BankAcc)
        {
            BankAcc = strReplace(BankAcc,';',',');
            qbdsBankAccountTable.addRange(fieldNum(BankAccountTable, AccountID)).value(BankAcc);
        }
        return query;
    }

    public boolean getFromDialog()
    {
        boolean ret = super();

        fromDate	= dfFromDate.value();
        toDate		= dfToDate.value();

        //Bank Account
        if (multiBankAccCtrl)
        {
            BankAccCon = multiBankAccCtrl.getSelectedFieldValues();
        }
        return ret;
    }

    /// 
    /// dialog
    /// 
    /// dialogLocal
    Object dialog()
    {
        #file

        DialogRunbase dialogLocal ;
        
        dialogLocal = super();
      
        dfFromDate	= dialogLocal.addFieldValue(extendedTypeStr(FromDate), fromDate,"@SYS5209");
        dfToDate	= dialogLocal.addFieldValue(extendedTypeStr(ToDate), toDate,"@SYS14656");

        fbscMultiBankAcc  = dialogLocal.curFormGroup().addControl(FormControlType::String, 'Bank Account');
        fbscMultiBankAcc.label('Bank Account');
       
        return dialogLocal;
    }

    /// 
    /// DialogPostRun
    /// 
    /// Dialog
    public void dialogPostRun(DialogRunbase dialog)
    {
        FormRun						formRun;

        super(dialog);

        formRun = dialog.dialogForm().formRun();

        if (formRun)
        {
            //Bank Account
            fscMultiBankAcc = formRun.design().control(fbscMultiBankAcc.id());
            multiBankAccCtrl = SysLookupMultiSelectCtrl::construct(formRun, fscMultiBankAcc, querystr(OABCashBookBankAcc));
            
        }
    }

  • RE: Default dimension business unit dialog form lookup with range

    found that method in aot and it worked thankyou

  • Verified answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Default dimension business unit dialog form lookup with range

    If you want to add a lookup to the business unit - Adding View to the query is not enough. You need to create one more lookup method for business unit similar to bank account and call the lookup method in dialogPostRun method.

    Thanks,

    Girish S.

  • RE: Default dimension business unit dialog form lookup with range

    ok its just that i want to add lookup for business unit at dialog form.and i also added default dimenskon in my query

    pastedimage1682062901484v1.png

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Default dimension business unit dialog form lookup with range

    I am still not clear with your requirement. Sorry.

    If you have any other requirements please elaborate more.

    Thanks,

    Girish S.

  • RE: Default dimension business unit dialog form lookup with range

    i dont have businessunitlookupname method in my class

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Default dimension business unit dialog form lookup with range

    On the dialogPostRun method you need to call the business unit lookup method.

     businessUnitControl = _dialog.dialogForm().formRun().control(businessUnitControl.id());
            businessUnitControl.registerOverrideMethod(methodStr(FormStringControl, lookup),
                methodStr(ClassName, BusinessUnitLookupName), this);

    Thanks,

    Girish S.

  • RE: Default dimension business unit dialog form lookup with range

    pastedimage1682061434603v1.png

    busniess unit list is not coming here

    Object dialog()
    {
    #file

    DialogRunbase dialogLocal ;

    dialogLocal = super();

    dfFromDate = dialogLocal.addFieldValue(extendedTypeStr(FromDate), fromDate,"@SYS5209");
    dfToDate = dialogLocal.addFieldValue(extendedTypeStr(ToDate), toDate,"@SYS14656");
    dialogBusinessUnit = dialogLocal.addFieldValue(extendedTypeStr(Str1260), strBusinessUnit, "@OAR:OAR00179");

    fbscMultiBankAcc = dialogLocal.curFormGroup().addControl(FormControlType::String, 'Bank Account');
    fbscMultiBankAcc.label('Bank Account');

    return dialogLocal;
    }

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Default dimension business unit dialog form lookup with range

    If you want to lookup bank account only with default dimension business unit then you can add the DefaultdimensionView in the CashBook query itself. Add the Name as a range under range node and set the value to "BusinessUnit". It will look up only the bank account which is having business unit value.

    Thanks,

    Girish S.

  • RE: Default dimension business unit dialog form lookup with range

    query buildQuery()

       {

           QueryBuildDataSource qbdsBankAccountTable, qbdsBankAccountTrans;

           Query query = new Query(queryStr(CashBook));

           qbdsBankAccountTable    = query.dataSourceTable(tableNum(BankAccountTable));

           qbdsBankAccountTrans = query.dataSourceTable(tableNum(BankAccountTrans));

            i have to add datasource here as well for default dimension view??

  • Suggested answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Default dimension business unit dialog form lookup with range

    Refer to the below code.

    query buildQueryBusinessUnit()
    {
           
        QueryBuildDataSource	qbds;
        Query query				= new Query();
        qbds = query.addDatasource(tablenum(DefaultDimensionView));
        qbds.addRange(fieldnum(DefaultDimensionView, Name)).value(queryvalue("BusinessUnit"));
        return query;
    }

    Thanks,

    Girish S.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,031 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,868 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans