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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

SysDa Classes (Pull sysDaqueryobject Query field to compare with SyaDaUpdateObject query field)

(0) ShareShare
ReportReport
Posted on by 167
Hi,
 
The goal is to get Taxitemgroupidsales from InventItemGroup table and update TaxItemGroupId for every item in InventTableModule (sales i.e. ModuleType =2) where TaxItemGroupId field is blank (not updated)
 
So, Using SysDaQueryobject joined 3 tables (inventTablemodule, inventitemgroupitem, inventitemgroup tables). 
 
Then, how to write where clause and setting clause by calling  SysDaUpdateObject class to update TaxItemGroupId field in InventTablemodule(sales)
 
 
 
 SysDaUpdateObject  updateObj;
 InventItemGroupItem itemgroupitem;
 InventTableModule InventTableModuleSales, TaxModuleSales;
 InventItemGroup  TaxinventItemGroup;
 ItemGroupId TaxItemGroupId;
 // Step 1: Subselect to get ItemGroupId from InventItemGroupItem
 
 SysDaQueryObjectBuilder Itemgroupbuilder =
 SysDaQueryObjectBuilder::from(itemgroupitem)    
 .innerJoin(InventTableModuleSales)
 .where(itemgroupitem, fieldStr(InventItemGroupItem, ItemId)).isEqualTo(InventTableModuleSales, fieldStr(InventTableModule, ItemId))
 .where(itemgroupitem, fieldStr(InventItemGroupItem, DataAreaId)).isEqualTo(InventTableModuleSales, fieldStr(InventTableModule, DataAreaId));
 SysDaQueryObject itemGroupSubSelect = Itemgroupbuilder .toSysDaQueryObject();
 
 itemGroupSubSelect.whereClause(new SysDaEqualsExpression(
     new SysDaFieldExpression(InventTableModuleSales, fieldStr(InventTableModule, ModuleType)),
     new SysDaValueExpression(2)));
 itemGroupSubSelect.whereClause(new SysDaEqualsExpression(
     new SysDaFieldExpression(InventTableModuleSales, fieldStr(InventTableModule, TaxItemGroupId)),
     new SysDaValueExpression(' ')));       
 
    
 // Step 2: Subselect to get TaxItemGroupIdSales from InventItemGroup
 // using ItemGroupId obtained above

 SysDaQueryObject TaxItemGroupSubSelect = new SysDaQueryObject(TaxinventItemGroup);
    
 SysDaQueryObject joinTaxitemGroupid = TaxItemGroupSubSelect.joinClause( SysDAJoinKind::InnerJoin, itemGroupSubSelect);
 joinTaxitemGroupid.whereClause(new  SysDaEqualsExpression(
     new SysDaFieldExpression(TaxinventItemGroup, fieldStr(InventItemGroup, ItemGroupId)),
     new SysDaFieldExpression(itemgroupitem,fieldStr(InventItemGroupItem,ItemGroupId))
 ));
 
 updateObj = new SysDaUpdateObject(TaxModuleSales);
 
Thank you,
Lakshmi
 
Categories:
I have the same question (0)

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

Responsible AI policies

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

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,340

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 640 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans