Hi,
I am trying to create my own filter on the salesTableListPage form. I want it to filter by packing slip number. So I have created a small form where the user will enter the packing slip id and click 'OK' and it will show/open the SalesTableListPage form with that sales order.
I have created a new display menuItem by adding new enum value to the salesTableListPage enum. I have added new IF condition to SalesTableListPageInteraction class > InitializeQuery method as below. When the menuItem is called then open the SalesTableListPage with the query I created inside this method. I tested it by passing static value and it does work. But I want it to capture the value from the form I have created.
Interaction class:
My form's clicked method code:
The clicked method opens the form but the filter the sales order with the static value i have added to the code. My whole point of asking this question is that how can I pass user value to the InitializeQuery method of the interaction class?
sorry for silly mistakes. it works
Now you have initialized a new Query but not defined what data sources it should have. Then you try to get a data source from that query. It fails because there are no data sources yet.
You still need to look closer at Martin's code. Can you see how his first line looks like?
thank you again, sorry I missed that.
Now, I have initialized the query but now I get an error about QueryBuildDataSource object not initialized
As the error message says, you haven't initialized the query object so it's null.
Look at the first line in Martin's code example.
Thank you for the reply Nikolaos and Martin.
If I add my query and call the menu item from clicked method, it does not execute my query, can you please check if there is something wrong, it fails on "qbds = query......" ?
You don't have to modify the form - you can merely pass your query to it:
Query query = new Query(queryStr(SalesTableListPage)); // Modify the query as needed - this is just an example QueryBuildDataSource salesTableDs = query.dataSourceName(tableStr(SalesTable)); salesTableDs.addRange(fieldNum(SalesTable, CustAccount)).value(queryValue('Cust1')); Args args = new Args(); args.initialQuery(InitialQueryParameter::createByQuery(query)); new MenuFunction(menuItemDisplayStr(SalesTableListPage), MenuItemType::Display).run(args);
In your second screenshot all code related to FormRun is unnecessary and should be removed. When you call MenuFunction().run() you already launch the form.
In SalesTableListPageInteraction you can get the args by this.listPage().listPageArgs(). Then you can read your value from Args and use it for filtering.
Another option is to find the correct SalesTable already in your clicked method and put the CustPackingSlipJour in args.record(). This way you would not need to write any code on the form. Not 100% sure if it works but I suggest trying it. Or, try putting the correct SalesTable in args.record().
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,104 Most Valuable Professional
nmaenpaa 101,156