PXDatabase.Update to update one field value from another in the same table / row

I am trying to write the following statement in Acumatica using PXDatabase.Update:

UPDATE MyTable SET MyField2 = MyField1

I want to use PXDatabase.Update for the upgrade process. I have used PXDatabase.Update many times using PXDataFieldAssign and PXDataFieldRestrict, and it works well. I cannot find the correct syntax for setting a field from another field in the same DAC (only certain values).

What is the correct syntax using PXDatabase.Update?

Edit: I am open to other calls that allow bulk updates other than PXDatabase.Update (1 update for the entire table by the company).

+4
source share
1 answer

, .

using (PXTransactionScope ts = new PXTransactionScope())
{
    PXDatabase.Update<MyTable>(new PXDataFieldAssign<MyTable.myField2>(PXDbType.DirectExpression, "MyField1"));
    ts.Complete();
}
+2

Source: https://habr.com/ru/post/1659347/


All Articles