Method directive

I am new to C# and method directives so would like some guidance regarding modifying a method directive. Method directive I am updating is post-processing.

Objective: Set the “Character05” field in the “OrderRel_UD” table to “Character12” in the “QuoteHed_UD” field.

Below snap shots include the mappings, my current C# that I need to add to the current method directive custom C# code.

image

Have you already tried searching this site for examples?
Below is a link to one of many I’ve read:

I liked that one because there were so many responses and included both working examples and potential issues/things to look out for:

1 Like

FYI, you are doing 4 database calls and returning whole records when all you wanted was one field.
In this case, I would offer a Data DIrective on OrderRel (don’t hate me guys…).
The query is the important part.

foreach (var tt in ttOrderRel.Where(tt => tt.Added() ))
{
	var char12 = (from D in Db.OrderDtl.Where(D => D.Company == tt.Company && D.OrderNum == tt.OrderNum && D.OrderLine == tt.OrderLine)
					join Q in Db.QuoteHed on
					new {D.Company, D.QuoteNum} equals
					new {Q.COmpany, Q.QuoteNum}
					select Q.Character12).FirstOrDefault();
	tt.Character05 = char12;
}
3 Likes