Skip to main content
Answer

Combine Update Statments

  • May 5, 2025
  • 1 reply
  • 24 views

I want to combine the below the Statement into a single one as it contains the same Where Condition and Column

 

  Update<TableName>
   .Set<TableName.OrderNbr.EqualTo<@P.AsString>>
  .Where<TableName.id.IsEqual<@P.AsInt>>
  .Update(Base, new object[] { orderNbr, Account.Id });

  Update<TableName>
.Set<TableName.Review.EqualTo<@P.AsBool>>
.Where<IAAccountAllocation.id.IsEqual<@P.AsInt>>
.Update(Base, new object[] { 1, Account.Id });

Best answer by jinin

Hi ​@anupusefulbi ,

Please try the following,

Update<TableName>
    .Set<TableName.orderNbr>(newValue => newValue.SetFrom<@P.AsString>())
    .Set<TableName.review>(newValue => newValue.SetFrom<@P.AsBool>())
    .Where<TableName.id.IsEqual<@P.AsInt>>()
    .Update(Base, new object[] { orderNbr, review, Account.Id });
 

1 reply

jinin
Pro I
Forum|alt.badge.img+11
  • Pro I
  • Answer
  • May 5, 2025

Hi ​@anupusefulbi ,

Please try the following,

Update<TableName>
    .Set<TableName.orderNbr>(newValue => newValue.SetFrom<@P.AsString>())
    .Set<TableName.review>(newValue => newValue.SetFrom<@P.AsBool>())
    .Where<TableName.id.IsEqual<@P.AsInt>>()
    .Update(Base, new object[] { orderNbr, review, Account.Id });