How to Use Xafari Numerator for custom numbering

StatusIDPriorityType
Closed28555TrivialQuestion
ProfileReply
doorscomputersClient

I am having a hard time using the Xafari Numerator to produce a Student ID based on the Current Year.
For example once I create a New Student Record the first record would be 2017-00001, then 2017-00002, 2017-00003......, then if I add a new Student next year, then the counter will go back to 1 it would be 2018-00001,2018-00002,2018-00003... for the following year 2019-00001,2019-00002,2019-00003 and so on
Thanks!

Replies

UserDescriptionPosted On
Sasha (Xafari Support)Client

Hello,

We apologize for the delayed response.
Unfortunately this additional function is not working for the Numerator, but we are going to solve the issue.

Thanks for your patience,
Sasha.

Sasha (Xafari Support)Client

Hello,

In new Xafari version you can use following settings, if you want set behavior as you described above.
You have to create numerator (Xafari Business Numerator): Model.DesignedDiffs.xafml (Model.xafml) -> Xafari -> Services -> Numerators: Add... -> ServicesNumerator and set a properties
- DerivedClassesBehavior = Apply,
- KeyTemplate = {0:DateTimeProperty,yyyy}, where DateTimeProperty - the name your property CurrentYear (see KeyTemplate),
- Template = {0:DateTimeProperty,yyyy}-{0:<INDEX>,00000} (see Template)
Numerator

Next step, add for your numerator Link: Add... -> ServicesNumeratorLink and set a properties
- ApplyStrategy = OnSave,
- ModelClass = name your class,
- Property = name a property for numerator
NumeratorLink

Class DateNumerator:

public class DateNumerator : BaseObject
{
public DateNumerator(Session session)
: base(session){ }private string _caption;
public string Caption
{
get { return _caption; }
set { this.SetPropertyValue("Caption", ref this._caption, value); }

private string _number;
public string Number
{
get { return _number; }
set { this.SetPropertyValue("Number", ref this._number, value); }
}

public DateTime DateTimeProperty { get; set; }
}

We hope you find this information helpful.
Feel free to contact us if you experience any further difficulties.
Best regards,
Sasha.

× This ticket is closed.

Write US