Hi everyone,
I'm working on a PXProjection that joins a parent table with a child table using a LEFT JOIN.
The relationship is one-to-many:
- One parent record can have multiple child records.
- Some parent records may have no child records at all.
The projection itself works as expected, but I'm unsure how the DAC keys should be defined.
The child table has a key field that is part of the projection's key. When there is no matching child record because of the LEFT JOIN, that key is NULL. However, a key field in a DAC cannot be null
What is the recommended approach for defining keys in this type of projection?
- Should only the parent table's key fields be marked with
IsKey = true? - Is there a best practice for projections that include optional child records?
- How do you handle one-to-many relationships where the child record may not exist?
I'd appreciate any guidance or examples. Thanks!