Error when specifying code in c#(Error al especificar codigo en c#)

Hi guys, I have a problem specifying an expression in c# and use it as callContextBpmData, when compiling this code, I miss this error, “Expression should contain only one statement”
it would be very useful your help, many thanks in advance,

What the code tries to do is show the value that was changed in the field of the table.

As you can see, I’m starting to program in epicor.

foreach (var ttJobOperRow.OpCode in ttJobOperRow)
{
if (String.Is null || Empty(OpCode.RowMod)) // This is the original, or unchanged row
{
var oldvalue = OpCode.RowMod;
}
}

(Hola chicos, tengo un problema al especificar una expresion en c# y usarla como callContextBpmData, al compilar este codigo, me salta este error, “Expression should contain only one statement”
seria de mucha utilidad su ayuda, de antemano muchisismas gracias,

Lo que el codigo trata de hacer es mostrar el valor que fue cambiado en el campo de la tabla.

Como se puede notar, estoy empezando a programar en epicor.

foreach (var ttJobOperRow.OpCode in ttJobOperRow)
{
if (String.Is null || Empty(OpCode.RowMod)) // This is the original, or unchanged row
{
var oldvalue = OpCode.RowMod;
}
}

try something like this

foreach (var ttJobOperRow in ttJobOperRow.Where(jo => !jo.Added() && !jo.Updated() && !jo.Deleted()))   //look at only rows that arent added, updated or deleted (aka unmodified)
{
//the var in your foreach gets referenced each time, we want the OpCode field from it
  var oldvalue =  ttJobOperRow.OpCode;
}

Also, this is C#, not C++. I only mention that as I wouldnt want you to google c++ code for use in Epicor as you may find some stuff that doesnt apply

2 Likes

thank you very much for the clarification, similarly I still see the error.

annex an image.

The error is pretty clear. It doesn’t like that you have more than one statement in the expression. Expressions are meant to be a single statement. You have a loop inthere.

1 Like

Hola Jose, muchisimas gracias por la aclaracion, vere donde esta el blucle

Like Jose mentions, the issue is you are trying to use an expression.What is your intention?

thank you very much for the attention, my intention to create this code and send it to call, is to show me also in the email that warns me of the update of an operation, to show me the operation that I had before it was changed.