Question
· Apr 11

Mapping an optional field to its optional subscript node

Hello all,

If we have a global structured something like this:-

  1. ^test(1)="Dave^Engineer"
  2. ^test(2)="Bethan^Manager"
  3. ^test(2,"transferred")="2024-01-04"
  4. ^test(3)="James^Administrator"
  5. ^test(4)="Sophia^Marketing Executive"
  6. ^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

Discussion (2)1
Log in or sign up to continue

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