Data Directive use value from another table

Hi

I have a very simple Data Directive that updates the FirmRelease field on the OrderRel table.

Currently, there is a condition that checks to see if the part number is equal to ‘CFG’. If it is, we set FirmRelease to false. This all works.

I would like to change the condition to look at the BasePartNumber field on the OrderDtl table. If this equals ‘CFG,’ then set FirmRelease to false.

Is there a way of looking up the value of BasePartNumber field in the OrderDtl when I am using the OrderRel table for my data directive?

You can use Linq.

Here’s an example: C# question about retrieving fields

2 Likes

I believe you can access the Db context directly … like:

var thisBasePartNum =
  Db.OrderDtl
    .Where(od =>
      od.Company == thisCompany &&
      od.OrderNum == thisOrderNum &&
      od.OrderLine == thisOrderLine)
    .Select(od => BasePartNum)
    .FirstOrDefault() ?? "";
2 Likes