Skip to main content

Notifications

Announcements

No record found.

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

to apply range on lookup based on form field value

(1) ShareShare
ReportReport
Posted on by 1,457
hi ,
 
I have made the lookup on data field on form line data source  now i want to set the range on that lookup so the lookup filter the value with invent location id in header or lines as the header and location id is unique key in form how can i get this done , please suggest me on this .
 
 
thanks,
Regards,
Dinesh
  • Dineshkarlekar Profile Picture
    Dineshkarlekar 1,457 on at
    to apply range on lookup based on form field value
    hi ,
    Martin ,
    Thanks for reply ,
    I forgot to add query in syslookup , fixed the issue  now lookup working fine .
     
     
     
    thanks,
    Regards,
    Dinesh 
  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,433 Most Valuable Professional on at
    to apply range on lookup based on form field value
    You forgot to describe your problem, but I see an obvious bug. You have a query for CustInvoiceJour table but you're trying to add a range for DTDMCHeader.InventLocationId. I guess you wanted CustInvoiceJour.InventLocationId (the fourth field in your lookup).
  • Dineshkarlekar Profile Picture
    Dineshkarlekar 1,457 on at
    to apply range on lookup based on form field value
    below is my code ,please help me out on this .
     [DataField]
            class InvoiceId 
            {
                /// <summary>
                ///
                /// </summary>
                /// <param name = "_formControl"></param>
                /// <param name = "_filterStr"></param>
                public void lookup(FormControl _formControl, str _filterStr)
                {
                    //super(_formControl, _filterStr);
    
                    SysTableLookup      sysTableLookup  = SysTableLookup::newParameters(tableNum(CustInvoiceJour), _formControl);
    
                    Query query = new Query();
                    QueryBuildDataSource queryBuildDataSource;
                    QueryBuildRange queryBuildRange;
    
                    queryBuildDataSource = query.addDataSource(tableNum( CustInvoiceJour));
     
                    queryBuildRange = queryBuildDataSource.addRange(fieldNum(DTDMCHeader, inventLocationId));
                    queryBuildRange.value(queryValue(DTDMCHeader.inventLocationId));
    
                    // Add the lookup columns
                    sysTableLookup.addLookupfield(fieldNum(CustInvoiceJour, InvoiceId));
                    sysTableLookup.addLookupfield(fieldNum(CustInvoiceJour, SalesId));
                    sysTableLookup.addLookupfield(fieldNum(CustInvoiceJour, InvoiceAccount));
                    sysTableLookup.addLookupfield(fieldNum(CustInvoiceJour, inventLocationId));
                 
                    // Run the lookup
                    sysTableLookup.performFormLookup();
    
                }
            }
     

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,703 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,433 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans