Xafari Index Numerator

StatusIDPriorityType
Closed40988MajorBug
ProfileReply
GoranClient

Hi, I'm trying to implement Index numerator on one of my classes

public class ProductionBOMLine : XPObject, IIndexNumberSupport
{

ProductionBOM productionBOM;
[Association] public ProductionBOM ProductionBOM
{
get => productionBOM;
set => SetPropertyValue(nameof(ProductionBOM), ref productionBOM, value);
}

int indexNumber;
[Persistent("LineNo")] [ModelDefault("Caption","Line No")] public int IndexNumber
{
get => indexNumber;
set => SetPropertyValue(nameof(IndexNumber), ref indexNumber, value);
}

I entered values into IndexNumber section of BOModel.
IndexParents: ProductionBOM
IndexStartValue: 10000
IndexStep: 10000

Unfortunatelly, numerator doesn't work. I have no idea what can be wrong.

Replies

UserDescriptionPosted On
MariyaVoytovichAgent

Hello!

Sorry for the delay with the answer.

For the IndexNumerator to work, you need to add the following controller to the project.

public partial class NumerateObjectsViewController : ViewController<DetailView>
    {
        public NumerateObjectsViewController()
        {
            InitializeComponent();
        }

        protected override void OnActivated()
        {
            base.OnActivated();

            if (!this.ObjectSpace.IsNewObject(this.View.CurrentObject))
                return;

            if (this.View.CurrentObject is IIndexNumberSupport indexNumberSupport)
			{
                this.ObjectSpace.Xafari().IndexNumerator().Apply(indexNumberSupport);
            }
        }
    }

The attached file contains a project with examples of using IndexNumerator.

Feel free to contact us if you need further assistance or have additional questions.

Regards,
Mariya
On behalf of Xafari Client Services Team

Attached files:

× This ticket is closed.

Write US