3
votes

I would like to ask a quastion.

Lets say that I have a grid in form. In this grid I have two fields. The first field is the orderId and second field is the invoiceId. Each field has already an overloaded modified method.

Lets say that my requirment is that if you fill the orderId in first field then the invoiceId should automatically filled in field 2. and the same should happend in the opposit way. If I fill the invoiceId then automacally the related orderId should be automacally in field1.

If for example comment out the related code of one method then works fine but only in one direction.

But if I want it to work for both direction my ax client stop working. Looks like an infinity loop through modified methods and the debuger cannot help me.

My quastion is...Exists any proper solution for this modified methods overlaping problem?

modified()// method for invoice Field
{
   SalaryProvRevisions table = SalaryProvRevisions_ds.getFirst(1) ?    SalaryProvRevisions_ds.getFirst(1) :SalaryProvRevisions_ds.cursor();
   table.OrderId=SalarayProvInvoiceHandler::getOrderIds(table.InvoiceId);
.
.
.
.
}

modified()// method for ordeid field
{
   SalaryProvRevisions table = SalaryProvRevisions_ds.getFirst(1) ? SalaryProvRevisions_ds.getFirst(1) : SalaryProvRevisions_ds.cursor();
   table.InvoiceId=SalarayProvInvoiceHandler::getInvoiceId(table.OrderId);
.
.
.
.
}

of course this story has some others problems like one orderId can be related with a lot invoiceid.. but already solved them.

Thanks a lot,

Nikos

1

1 Answers

3
votes

Your modified methods has no call to super() in the start of the method which may be the reason. Also you methods as listed do not compile due to missing return type.

I will advise you to do your customization in the modifiedField method of the table.

public void modifiedField(FieldId _fieldId)
{
    super(_fieldId);
    switch (_fieldId)
    {
        case fieldnum(SalaryProvRevisions, OrderId):
            this.InvoiceId = SalaryProvRevisions::getInvoiceId(this.OrderId);
            break;
        case fieldnum(SalaryProvRevisions, InvoiceId):
            this.OrderId = SalaryProvRevisions::getOrderId(this.InvoiceId);
            break;
    }
}

I would move the location of the get methods to table itself where they truly belongs.