Skip to main content

Adding AND condition between same fields in query using QueryBuilder in x++ in D365 | AX2012

Hello Devs!
While working with multi value lookups and using it to exclude values we normally encounters this problem that the filter doesn't works properly and applies filter on any one value
Scenario :












while adding multiply value filter through "addRange()" MS dynamics AX has out of the box functionality that it adds OR between the filter values so that is the reason our filter doesn't works properly and applies filter on any one value but this is the case when we use it for excluding values
like it makes the expression like this
WHERE ((NOT (InvoiceAccount = N'V000001')) OR (NOT (InvoiceAccount = N'V000002')))
where as we want it as this to apply the filter perfectly
WHERE ((NOT (InvoiceAccount = N'V000001')) AND (NOT (InvoiceAccount = N'V000002')))

Solution: 
1)We would be using either a regular table or a Temp table to inserting values in to it
2)The table should contain the same field on which we wants the filter to be applied
3)Adding a NoExitsJoin to our created table with the main data source

here I have written the piece of code to achieve this
Note: Here qbdsCMTInvoiceAccExcludeTMP is of QueryBuildDataSource type



Comments

Popular posts from this blog

D365 Print Management Setup to print reports

In Microsoft Dynamics Ax D365, we have the out of the box feature of print management to print report either OOTB or custom reports of our clients so for that we need to configure the print management settings. We normally faces this warning message when we print the reports without the setting has been done. Firstly , select Form setup ( Accounts Receivable >> Forms >> Form setup  ) Secondly, In the General tab , select Print Management Thirdly, In the Document Tab right click and select New tab Moreover , we need to set the listed below details and need to select our required reports to load using print management Furthermore , we now nee to go to All Free Tax Invoices in AR Lastly you can use the FTI to generate the respective report using the print button. This time the Warning will be Gone!!! 

Upload and Download file to BLOB storage Account in D365 F&O using X++

Hello Devs! This blog will be a source of help for many Devs who are working on Azure Blog Storage account. We normally use azure blob storage account to hold thing that need to be further processed and stored on cloud. Scenario:  We have been asked to * Upload file to azure * Download file from azure "We will be using Share File Management technique" Case #1 : Uploading File to Azure  Note : Here we are using  PurchParameter  table to extract urls and other folder related details you can use your own folder name to access the azure blob folder Further, Credential details have already been extracted i.e vault key,authorization key and has been stored in our custom table and extracted from d365 through azure parameters  storageCredentials  = new Microsoft.WindowsAzure.Storage.Auth.StorageCredentials(SystemParameters::find().CMTStorageAccountName, purchParameters.CMTTankKeyVaultSecret); Or alternatively, CloudStorageAccount storageAccount = ...

Update record set using update_recordset in d365 F&O | AX 2012 using X++

Hello Devs! One the most common condition that we being a developer faces is to update existing records set that is mostly done on report level when we need to add new fields in the Temporary table and we don't wants to make extensions on class level. Here is a small piece of code that will assist you in updating existing record sets.  update_recordset custAgingReportTmp                 setting                 CMTCustInternalCollector = hcmWorker.PersonnelNumber,                 PaymDayId                         = custTable.PaymDayId,                 PaymTermId                       = custTable.PaymTermId,                 CashDisc      ...