Archetype Designer: how to set list or pattern constraints on a DV_TEXT?

Hi,

I’m trying to set a list of values possible for a DV_TEXT.value: String and those options are not displayed in the “constraints”.

I can only see the constraints at the ELEMENT level, but not at the ELEMENT.value, in my case it’s a DV_TEXT.

For reference I need to apply constraints of type C_STRING on the DV_TEXT.value Archetype Object Model 1.4 (AOM1.4)

Though I can set the constraint manually in the ADL and it validates, but when I save the archetype, it disappears.

ELEMENT[at0007] occurrences matches {0..1} matches { – text
value matches {
DV_TEXT matches {
value matches {“aaa”,“bbb”}
}
}
}

It becomes:

				ELEMENT[at0007] occurrences matches {0..1} matches {    -- text
					value matches {
						DV_TEXT matches {*} <<< meh!
					}
				}
1 Like

Generally, when modelling archetypes as opposed to templates, any text value set is modelled as DV_CODED_TEXT, not DV_TEXT. The codes are automatically assigned as at-codes. In templates you can however add value sets to DV_TEXT elements.

The original Archetype Editor did initially support lists of text but the functionality was removed, as it was felt it was not good practice, certainly at archetype level.

Our policy now is always to add coded lists at template level, even if this is just a pseudo-coded list.

That’s ok the only issue I see it’s that differs from the specs, so the specs offer something that modelling tools don’t offer.

I think when there is a guideline or a best practice approach, that should be fed back into the specs.

1 Like

Last week I also have a case where I needed to constraint the DV_IDENTIFIER.type and that should be a C_STRING from the AOM. In my case I needed to use the C_STRING.list constraint, since `type` is a String, we can’t apply a DV_CODED_TEXT/CODE_PHRASE constraint to it, but the AD doesn’t allow to constraint those Strings, so I needed to manually modify the ADL to generate a valid constraint. I also needed to generate my own ADL > OPT generator since if I add the modifier archetype to the AD and I create and export the OPT there, the constraint disappears.

Though back to the constraint, while playing around I found some strange behavior: the C_STRING.list is actually allowed in some places, like PARTY_REF.type, but as said, it’s not allowed everywhere where there is a String in the RM, like in the DV_IDENTIFIER fields.

	roles cardinality matches {1..*; unordered} matches {
		PARTY_REF[at0054] occurrences matches {0..1} matches {    -- PARTY_REF
			type matches {"a","b","c"}
		}
	}

So there is some kind of inconsistency in terms of the constraints and how/where they can be applied.