Skip to content

programmfabrik/fylr-plugin-numeric-id-auto-incrementer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This Plugin / Repo is being maintained by a community of developers. There is no warranty given or bug fixing guarantee; especially not by Programmfabrik GmbH. Please use the GitHub issue tracking to report bugs and self organize bug fixing. Feel free to directly contact the committing developers.

Numeric ID auto incrementer plugin

This server plugin for fylr allows automatically setting the values of numeric ID fields when saving data. IDs are assigned in numerical order starting from 1 for each combination of values present in a defined set of base fields (see example below). Please note that the ID field as well as all base fields are expected to be either grouped inside the same nested field or located at the root level of the object.

Installation

The latest version of this plugin can be found here.

The ZIP can be downloaded and installed using the plugin manager, or used directly (recommended).

Configuration

All plugin configuration takes place in base configuration.

  • Object types:
    • Object type name: The name of the object type for which to set up ID generation
    • Parent nested fields:
      • Path to parent field: The path to the nested field that contains the ID field and the base fields (leave empty if the ID field and the base fields are on the root level of the object).
      • ID field name: The name of the ID field to be filled out by the plugin. This has to be a numeric field. The field will only be updated if it is empty, if the parent field has been newly created and if all base fields have been filled out by the user.
      • Base field names: The names of the base fields to consider when setting the ID. These can be text fields or fields of the custom data type DANTE.
      • IDs of pools to consider: If not empty, IDs are only updated for resources in the specified pools (and their child pools). Also, resources in other pools are not considered during ID generation.
    • Maximum number of non-indexed objects: If not empty, the plugin will check if the indexer is still working by looking at the number of non-indexed objects. If the number is higher than the value specified here and an ID would have to be created, the object will not be saved and an error message will appear instead. This setting can be used to prevent the generation of incorrect IDs in the case of an overloaded indexer.
    • Text of indexer error message: This text is shown as the error message that appears if the maximum number of non-indexed objects is exceeded and the object is not saved.

Example

Configuration

  • Object type name: example
  • Path to parent field: _nested:example__parent
  • ID field name: id
  • Base field names: place, year

Result

The field "id" contains the respective value as generated by the plugin.

Object 1:

{ "_nested:example__parent": [ { "place": "London", "year": "2020", "id": 1 }, { "place": "Berlin", "year": "2020", "id": 1 }, { "place": "Berlin", "year": "2020", "id": 2 } ] } 

Object 2:

{ "_nested:example__parent": [ { "place": "London", "year": "2020", "id": 2 }, { "place": "Berlin", "year": "2020", "id": 3 } { "place": "Berlin", "year": "2021", "id": 1 } ] } 

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published