Skip to main content

Notifications

Announcements

No record found.

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

how to add multiple range in AOT query while using sysRangeutil class method with OR

Posted on by 2
Added a range in newly created AOT query for field AccountNum.
Need to add one more range with OR condition ,for field /InvoiceLocation/, If I add one more range its taking as /and/ condition. 
Using SysRangeUtil class method for passing range value.
Trying to use below code for Range value:
 
[ExtensionOf(classStr(SysQueryRangeUtil))]
final class TestSysQueryRangeUtil_Extension
{
    
    [QueryRangeFunctionAttribute()]
    public static str getVendorAccountNum()
    {   
        RecId                   partyRecID;
        AccountNum              vendorAccount;
        str                     vendorWarehouse;
              
        XdsVendorwarehouseSetup   userWarehouse;
        
        userWarehouse = XdsVendorwarehouseSetup::find(curUserId());
 
        // vendorWarehouse = strfmt('(/%1/ || (%2 == /%3/))',userWarehouse.VendAccount,fieldstr(VendTable,InventLocation),userWarehouse.InventLocationId);

        vendorWarehouse = strfmt('(%1 == /%2/ || (%3 == /%4/))',
                fieldstr(VendTable,AccountNum), 
                userWarehouse.VendAccount,fieldstr(VendTable,InventLocation),
                userWarehouse.InventLocationId);
       
                      
        return vendorWarehouse;
    }
}
 
No records coming for the above.
  • CU24110658-0 Profile Picture
    CU24110658-0 2 on at
    how to add multiple range in AOT query while using sysRangeutil class method with OR
     
    Thank you Andre for response,
     
    yes XdsVendorwarehouseSetup   is custom table which contains fields userId, InventLocation , and AccountNum .
     
    I need to filter the query based on these two fields inventLocation and AccountNum with or condition, for current user.
     
  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,253 Super User 2024 Season 2 on at
    how to add multiple range in AOT query while using sysRangeutil class method with OR
    Hi,
     
    Can you explain more about the object XdsVendorwarehouseSetup as this is not standard? I might assume it is a table. In that case, do you have correct contents in the table? If so, you can use the debugger to check the query range created by your customization and if the correct call will be send to SQL server.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans