Mapping an optional field to its optional subscript node
Hello all,
If we have a global structured something like this:-
- ^test(1)="Dave^Engineer"
- ^test(2)="Bethan^Manager"
- ^test(2,"transferred")="2024-01-04"
- ^test(3)="James^Administrator"
- ^test(4)="Sophia^Marketing Executive"
- ^test(4,"transferred")="2023-11-20"
It is fairly straightforward to map, and from a reading perspective everything works fine, but when inserting/saving the "transferred" node is created even if the 'transferred' field is not set. Is there a way to populate the node only if the field mapped to it is set?
Thanks
Colin
you describe 2 different record layouts that reside within the same storage
#1 - just a name
#2 - a name + a "transferred" property
depending on the situation you use either layout #1 or layout #2 for INSERT
reading might be OK for layout #2 in both cases.
Caché once had a somewhat similar sample with Person
and Employee extending Person.
available here: https://docs.intersystems.com/iris20241/csp/docbook/Doc.View.cls?KEY=ASAMPLES
this Repo:
https://github.com/intersystems/Samples-Data/tree/master/cls/Sample
Thanks Robert, I wondered if there was a way of doing it within the same class, but what you have suggested will work.