Field Value Pattern
What is the Field Value Pattern?
The field value pattern is a counter. This counter can start from 1 or A or a. It can have fixed prefix, suffix etc. This is not a global counter, rather a counter with respect to the parent.
Example:
A B
/ | \ / | \
1 2 3 2 3 4
Fig-1
In the above example, A has three children having field value 1, 2, 3. And B has three children field value 2, 3, 4. Field value 2 is valid in both cases. Because it is valid for different parents (A and B).
Global counter:
In the example above, If we add a child in A, it will have field value 1, then if we add a child to B, it will also have a value 1, since the counter is with respect to the parent. In ISAD-G, we can set the Arkiv as a global counter (from the three-dot menu), then any stykke created will have continuous counter, which is not respect to its parent (Serie), but will be respect to the arkiv. So the above example would be A → 1, 2, 3; B → 4,5,6
What are the field value pattern configurations?
Start From: The start value of the counter can be configured. Currently the valid start values are a single digit, ‘a’, ‘A’.
Prefix: The field value can have a fixed prefix. For example if the prefix is set to ‘L’, then the example in figure 1 will be as follows:
A B
/ | \ / | \
L1 L2 L3 L2 L3 L4
Fig-2
Suffix: Similar to prefix. For example if suffix is set to R then the example of figure 2 will be as follows:
A B
/ | \ / | \
1R 2R 3R 2R 3R 4R
Fig-3
Prefix and suffix can be imposed at same time. For prefix L and suffix R the example is as follows
A B
/ | \ / | \
L1R L2R L3R L2R L3R L4R
Fig-4
Current year as prefix: Current year will be considered as prefix.
A B
/ | \ / | \
2023/1 2023/2 2023/3 2023/a 2023/b 2023/c
Fig-5
Prepend from parent: While selecting prepend from parent, the parent entity along with the parent field needs to be selected. Then the value of the field of the selected parent will be appended to beginning of the field value. The applicable parent will be the immediate parent. E.g. If we have Serie1 → Serie2 → Serie3, then parent for Serie3 will be Serie2
Lets assume that prepend from parent is checked and selected parent entity is A and field is b.
A(a = “2”, b = “kk”)
/ | \
Kk1 kk2 kk3
Fig-6
Length: Length means the length of field value pattern. For start value upper case character [‘A’, ‘B’ etc] and lower case character [‘a’, ‘b’ etc] length should be 1. For digit [0-9] length should be at least 1. The number will be padded with starting zero. For example if the start value is 11 and length is 5 the starting value is 00011. The max field value length will be equal to length. That means single for uppercase or lowercase character the max value is either ‘z’ and ‘Z’. This length does not include the length of prefix or suffix.
Must have same parent: If this checkbox is checked, field value pattern will work if and only if the parent of the object is of same type. For example ,serie has self reference. That means series can have serie as child. If this checkbox is checked, field value pattern will work from second level of serie.
How to find the field value pattern setting?
The user will be able find this option under the preference. To access the field value pattern, the user needs to
go to the preference option
Select the desired project.
Select an entity under that project.
What is regenerate?
Regenerate button can be found under the crud list if there is any field value pattern defined on any fields of the entity. If regenerate is clicked, all the fields of all objects with field value pattern set will be recalculated. The regeneration will not be confined with items in UI, it will regenerate the fields of the object of the backend. If any column is sorted, the regeneration will follow the sort column while regenerating. This button will not appear if no field value pattern is set from the entity. While regenerating a pop up will appear for start value. Then the user has to input the start value. The start value must comply with the field value pattern (prepend from parent, length, prefix, suffix, start year). Regeneration will regenerate values for all the children.
What is move and regenerate?
Move and regenerate means regenerating after a move. There is a button move in the crud list. After clicking the move button user has to select objects. After selecting a pop up tree will show up. Here two types of arrow buttons can be found. One is bordered arrow and another is unbordered arrow. Unboarded arrows are used for move and regeneration, while the bored ones are used for move. If the boarded arrow is used, the selected objects will go under that object. If the unboarded arrow is clicked, the selected objects will be put on between the gaps of the siblings. Then the regeneration will be imposed on the siblings from the starting offset to the ending offset. And the we already know that for regeneration we have to insert a starting value. Here in move and regenerate we need a starting value. Here we don’t need to insert a start value. The value of the object of the starting offset before the move will be considered the start value. And the start value needs to comply with the field value pattern. Otherwise there will be an error. If there are more than 1 FV pattern, the move and regenerate won’t work, as we can’t regenerate both since it depends on the ordering of the entities.
What are the effects on insert?
While inserting a object using angular client, the uniqueness of the field value pattern will be ensured. If there is no filed value pattern there will be no uniqueness check. There will a check box “use latest field value”. If this check box is checked no matter what field value is inserted through the ui, the latest field value will be inserted. By latest field value, the max value plus one is meant. If the checkbox is not checked the uniqueness among the siblings are checked. In the crud list add option there is not visible checkbox. The check box is implicitly checked. So the latest field value will be inserted.
What are the effects on update?
There will be no effect from backend on checking the uniqueness of the field value pattern.
What are the effects on import?
Duplicate will work depending on field value pattern.
Duplicate check will be omitted for empty field value. eg. duplicate empty field value will be considered valid.
Duplicate check will be omitted for orphan objects. But with one exception. Which is if the root entity has a self reference, it mean actual root. And then duplicate check will be done. eg. Let’s say Arkiv has arkiv owner. Then orphan arkiv mean actual root arkiv. For other case orphan objects are not considered for duplicate check.
Duplicate check will be done considering must have same value( first level serie will be omitted and 2nd level serie will be validated)
Duplicate check will be done on excel import, single archive import (from gui server).
Duplicate check will be done on normal import (from flat or tree) if large import checkbox is unchecked
Effect on batch create?
There will be no effect from backend on checking the uniqueness of the field value pattern.
Effects of updating the pattern with already existing entities
If there are already existing entities (e.g. 1, 2, 3). And we update the pattern to start from 7, the next created entity will be 4, not 7. This is because we first check if this is the existing pattern (in this case, both the patterns are similar - numeric) and then check the latest value and increment from there. If we instead update the preffix, suffix or the field length, then it will be an entirely new pattern, and the value will restart accordingly.
User preference, Global preference
Patterns can be user preference or global preference. If user preference is set for a field, the global preference will be ignored for that field.
If there is a global preference, and in user preference must have same parent
flag is set, but the entity does not have same parent, the field should be left blank - the global will also not be effective here.