This new feature provides an automatic mechanism where a unique number can be assigned to a field upon the creation of an element without any complex wiring, smart columns, field activation or user-driven SQL queries. You can also populate missing values on elements previously created.
Please note that this feature is only available for whole numbers and can work in conjunction with key field support with Data Tables.
- If you go to File > Manage Repository > Manage Themes
- Select the relevant Theme and Theme Type
- Go to the Definition Window
- The Definition window has been updated to accommodate the Incrementing Number option and the key field option has been revised for clarity.
- Find your required field - ensuring that it is a whole number. You will notice that the additional tick boxes within the Definition tab will become available for this selection.
- Select 'This field creates an incremental number automatically' and MooD will automatically start calculating the next value (shown below).
Click 'OK' and then reopen Manage Themes in order for the calculation to complete (this can be reopened instantly but must be closed and reopened in order for it to take effect). The 'Next value' replaces 'Default value'. This means that if you were to create a new element in MooD the next field value for the selected field (in this case Task ID) will be the number calculated (in the case below, 10670). As more new elements are created, that number will change - going up in sequential order.
- You also have the ability to retrospectively populate missing values for existing elements; however, it will populate these empty values based on the 'Next value'. It will not go back and work out which number should be in place between two other numbers. o E.g. if you have values on elements such as missing, 2, 3, 4, 5, missing, 7, 8 ,9 o The 'next number' will be 10 so the values will be 10,2,3,4,5,11,7,8,9.
- Imagine the scenario if we had a number of elements whose Task ID fields have the values below, the gaps representing where there is no field data in the Task ID field. Imagine also that we had previously created Task IDs up to 10669 and subsequently deleted elements for IDs 9144 and above.
- If we were to go back into Manage Themes and tick 'Populate missing values for existing elements’ we would be presented with a warning dialog - this is a precautionary measure as so many elements have the chance of being affected.
- You can now see that the empty fields have been populated. o Please note that the retrospective population has no order, even though it will take numbers from the 'Next value' onwards, they will appear to users to be populated randomly. MooD has also not fixed the erroneous duplicate values.
We have accumulated a list of frequently asked questions (FAQ), some of these are below.
Which types of fields are supported?
Integer fields only, but not those within Data Tables.
How do I get a representation of 0001?
Use String Smart Columns, with custom function facts to insert the padding, using an SQL syntax of: REPLICATE( ‘0’, 5-LEN(field)) + CAST(field as varchar)
What happens when I turn numbering on?
Any subsequent (new) elements created via Synchronization, Business Architect, Active Enterprise will have the value created in their fields, automatically. Gaps in existing data aren’t automatically filled. If you had existing field values, the Next Value will be the greatest value present +1.
What happens when I turn numbering off?
Nothing, except new elements will no longer have a field value in the field populated automatically.
Should I pin to this field?
We recommend not adding this field in Form Creators or editors, or as an editable field in Active Enterprise controls. Do not pin to this field as an input. We also recommend you do not connect this field to a Synchronization import. Let MooD be the sole controller of these fields.
What happens when I click ‘Populate missing values’?
Any elements fields which are empty will receive an incremental number starting from the next largest available number.
What happens when I click ‘Reduce’?
The Next Value number will be reduced, calculated on the maximum number present in your element’s data. But use with caution, if you have deleted some elements, and those came from external systems, MooD will start to produce duplicate values (if those elements are reimported).
When should I click Reduce?
If you have created some local/extra test data before shipping a repository, and then deleted the test data; you want to ignore your test data and reduce the number as not to affect the customer’s solution.
Are numbers unique to Type or Theme, or Field Type?
Incremental numbers are unique within the Type (e.g. Process).
What about fields in relationships?
Incremental number fields in this situation are unique to the relationship type, not individual elements or types. Thus, when using the same relationship type, a relationship created on process P1 will have number 1 and the next relationship created on object O1 will have the number 2.
What happens if I pin a value to an incrementing field?
The incremental number feature is overridden and the value will be overwritten by the pinned value. In creation situations, the Next Value will increment because value was assigned for a split second.
What happens if I connect a Synchronization to a number field (import)?
As above, you are overwriting the number field. The Next Value will increment because value was assigned for a split second.
What happens if I add an incremental number field to a form creator?
What happens if I use an incrementing field as an output (Pin/Synchronization/Variable)?
Nothing, it is just like any other field value.
Can I edit the resulting field value?
Yes, so that you can correct errors. We may lock this down in future.
What happens if I have duplicates?
Repository Validator can provide a report on this, but does not fix the issue for you.
What happens if I have gaps?
Repository Validator can provide a report on this, but does not fix the issue for you. You can fix this yourself by editing the values, or by using the ‘Populate missing values’ functionality in Manage Themes.
Can I choose the starting Next Value or alter the Next Value?
If my next value is 23 in Manage Themes, and my data only reaches 20, what happens if I turn the feature off and back on again?
The next value will be 23. MooD does not forget unless you press Reduce. This is to assist Deployment Packs and Integrator.
Can I use Deployment packs with this feature?
Yes, the Next Value will be recalculated as Max( source.field.NextValue, target.field.NextValue, target.fielddata.largestvalue+1 ). You can turn on/off incremental numbers with deployment packs. Your resulting field data may however contain duplicates.
Can I use Integrator with this feature?
Yes, as above; however, Integrator uses the modification date to decide the correct state of the field, the number is calculated in the same way. Your resulting field data may, however, contain duplicates.
I’ve set the Minimum and Maximum ranges of the type but they are ignored.
Yes, this is by design. The minimum and maximum number ranges are 1 to 999,999,999,999,999.
What happens if my number reaches 999,999,999,999,999?
The next value issued will be 1. There is an issue that a repair will reset the value to 1 every time a repair is run.
Why do form creators/validators/flipsides let me pin to these fields?
We can’t predict what your intention is; maybe you want to turn off numbering, or you previously didn’t have it on.
Please sign in to leave a comment.