4
votes

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 an upgrade process. I have used PXDatabase.Update many times using PXDataFieldAssign and PXDataFieldRestrict and this works well. I cannot find the correct syntax to have a field set from another field in the same DAC (only specific values).

What is the correct Syntax using PXDatabase.Update?

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

1

1 Answers

2
votes

The following should do what you're looking for.

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