web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

To filter the warehouse on another form using the check box click

(1) ShareShare
ReportReport
Posted on by 1,836
Hi , everyone ,
I have created the check box form and i select the warehouse on this form and select the check box to yes so when the check box is yes  for the slected warehouse i need to se the records of only that warehouse hou can i get this done please guide me on this .below is the tab on my form .
thanks,
Regards,
Dinesh
I have the same question (0)
  • Martin Dráb Profile Picture
    238,272 Most Valuable Professional on at
    I'm sorry, but you gave us way too little information.
     
    I understand you want to filter some records by warehouse, but you told us nothing about what the records have to do with a warehouse. Do they have a warehouse field, or InventDimId, or is there a relation through another table, or something else?
     
    It's also not clear how the warehouse is selected.
     
    In short, you told us nothing about the form and the tables, so it's impossible to give you an answer. You also didn't explain what problem you have with it. I'm assuming that you already how to use a query range (I believe we talked about it in your other threads), therefore your current problem is likely related to something else...
  • Dineshkarlekar Profile Picture
    1,836 on at
    hi martin 
    thanks for reply ,
     I want to filter the warehouse on create sales order form , my table do not have any relation with sales table , i have written the lookup on extension of datasource , but not getting how to pass the range of my table in the lookup , and i also want to apply range when the check box is ticked .
    below is the code for lookup , but this will not work , how can get the value of warehouse from my custom form and pass here when the checkbox is ticked on that  form , can you please guide me on this .and sales table and my custom form table do not have any realtion .
    [ExtensionOf(formdatasourceStr(SalesCreateOrder, SalesTable)) ]
    final class DTSalesCreateOrderForm_Extension
    {
        public void lookup(FormControl _formControl, str _filterStr)
        {
                Query                   query = new Query();
                QueryBuildDataSource    queryBuildDataSource;
                QueryBuildRange         queryBuildRange;
    
    
           
    
                SysTableLookup          sysTableLookup;
                sysTableLookup = SysTableLookup::newParameters(tableNum(InventLocation), _formControl);
    
            queryBuildDataSource = query.addDataSource(tableNum(InventLocation));
            queryBuildRange = queryBuildDataSource.addRange(fieldNum(InventLocation, inventLocationId));
            queryBuildRange.value(queryValue(DTDMCHeaderLines.inventLocationId));
    
            sysTableLookup.addLookupField(fieldNum(InventLocation, InventLocationId));
    
    
            sysTableLookup.parmQuery(query);
            sysTableLookup.performFormLookup();
        }
    }
    
     
     
  • Suggested answer
    Waed Ayyad Profile Picture
    9,047 Super User 2025 Season 2 on at
    Hi Dinesh,
     
    Form your code you added method lookup on the form data source, but you don't connect it with the field that you want on the form? 
    You should follow this ink in order to override Lookup through extension.
     
    Also, you can add the Checkbox field as a range on your query. For now, read the blog and apply it in order to get the lookup work.
     
    Thanks,
    Waed Ayyad
     
     
     If this helped, please mark it as "Verified" for others facing the same issue
  • Dineshkarlekar Profile Picture
    1,836 on at
    Hi wyed ,
     Thanks for reply ,
      i want to apply the range from the another form datasource table , and i am applying the lookup on datafield method of form datasource  , if this field is used on anyother place the lookup will be applied to that also , i tried to call the datasource of my custom form in lookup method my code is below , can you please guide me on this please.
    [ExtensionOf(formdatasourceStr(SalesCreateOrder, SalesTable)) ]
    final class DTSalesCreateOrderForm_Extension
    {
    
        [DataField]
        class InventLocationId
        {
            public void lookup(FormControl _formControl, str _filterStr)
            {
                Args    args;
                FormRun formRun;
    
                //Call the form directly.
                Args = new Args(formStr(DTAssignTransactionAccess));
                
                formRun = New FormRun(Args);
                formRun.init();
                formRun.run();
                formRun.wait();
    
                FormDataSource                   salesTransAccess_ds = formRun.dataSource(formDataSourceStr(DTAssignTransactionAccess,DTSalesTransactionAccess));
                DTSalesTransactionAccess         salesTranAccess = salesTransAccess_ds.getFirst() as DTSalesTransactionAccess;
    
                Query                   query = new Query();
                QueryBuildDataSource    queryBuildDataSource;
                QueryBuildRange         queryBuildRange;
    
                SysTableLookup          sysTableLookup;
                sysTableLookup          = SysTableLookup::newParameters(tableNum(InventLocation), _formControl);
    
                queryBuildDataSource = query.addDataSource(tableNum(InventLocation));
                queryBuildRange = queryBuildDataSource.addRange(fieldNum(InventLocation, inventLocationId));
                //queryBuildRange.value(queryValue(inventLocationId));
    
                sysTableLookup.addLookupField(fieldNum(InventLocation, InventLocationId));
    
    
                sysTableLookup.parmQuery(query);
                sysTableLookup.performFormLookup();
            }
    
        }
      
    }
     
  • Suggested answer
    Waed Ayyad Profile Picture
    9,047 Super User 2025 Season 2 on at
    Hi,
     
    Now, your code isn't working, so try this link to guide you how to override the lookup:
     
    Also, since the check box is on another form DataSource you can simply use select statement, but my question is you want to add filter to what? to the Warehouse field? do you want to return on Lookup only the warehouses that have your checkbox field is checked? 
     
     
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
     
  • Waed Ayyad Profile Picture
    9,047 Super User 2025 Season 2 on at
    Hi,
     
    Did you try my solution? does your lookup now return values?
    If yes, verify my answers in order to help others who will face the same issue.
     
     
    Thanks,
    Waed Ayyad
     
     
  • Dineshkarlekar Profile Picture
    1,836 on at
    hi , thanks for reply ,
    lookup is working but i am getting issue in passing multiple value in query range of lookup , i tried to pass the value in lookup using container but the lookup appears to be blank ,  i am getting the value in container but still lookup is getting only one value.
  • Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at
    Can you show us the code where you are passing range value in a container to query range?
  • Dineshkarlekar Profile Picture
    1,836 on at
    hi ,
    thanks for reply ,
     my code is below i have replace the container with while loop but i am getting 2 queries in query .
    below is my code . its not hitting when i debug the original lookup is opening , what i want to do is if stock field is yes then my lookup should open else original lookup open .can you please guide me on this .
     
    [ExtensionOf(formDataFieldStr(SalesCreateOrder,SalesTable,InventLocationId))]
    final class DTSalesCreateOrderForm_TransactionAcess_Extension
    {
    
        public void lookup(FormControl _formControl, str _filterStr)
            {
                next lookup( _formControl, _filterStr);
                UserId    userid ;
                UserInfo  userInfo;
                container      inventLocationId;
                //inventLocationId    inventId;
                Query                            query = new Query();
                QueryBuildDataSource             queryBuildDataSource;
                QueryBuildRange                  queryBuildRange;
                DTSalesTransactionAccess         salesTranAccess;
                      //FormControlEventArgs e;     
    
           userid = curUserId();
            select id from  userInfo
                where userInfo.id == userid;
    
            while select * from salesTranAccess
                where salesTranAccess.UserId == userInfo.id
                && salesTranAccess.Stock == NoYes::Yes
            {
                if(salesTranAccess)
                { 
                        inventLocationId  += salesTranAccess.inventLocationId;    
                }
              
            }
    
            queryBuildDataSource = query.addDataSource(tableNum(InventLocation));
            queryBuildRange = queryBuildDataSource.addRange(fieldNum(InventLocation, inventLocationId));
            queryBuildRange.value(con2Str(inventLocationId));
    
            SysTableLookup          sysTableLookup;
            sysTableLookup          = SysTableLookup::newParameters(tableNum(InventLocation), _formControl);
    
            sysTableLookup.addLookupField(fieldNum(InventLocation, InventLocationId));
    
            sysTableLookup.parmQuery(query);
            sysTableLookup.performFormLookup();
              
            //FormControlCancelableSuperEventArgs ce = e as FormControlCancelableSuperEventArgs;
            //ce.CancelSuperCall();
               
            }
    
    }
     
    thanks ,
    REGARDS ,
    dinesh
     

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

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 843 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 428 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 357 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans