Please, give me simple example with this case.
Thanks and Best regards
--
AX Technical Consultant
this.Column = MyTable.Column + 1;
}
super();
}
Thanks
Sudhir
http://www.sudhirpaliwal.blogspot.com/
If you are creating the records in a form (like SalesTable) you can specify
the LineNum as CounterField on the DataSource.
You can see with my sreen shoot follow this link (I don't know how to give
attachment file via this forum):
http://www.dayza.com/Users-Photos/1254838326.gif
http://www.dayza.com/Users-Photos/1254838382.gif
Best regards
--
AX Technical Consultant
Home page: http://erp4vn.net
I can think of two things:
#1
First of all you data sources seems to be in the "wrong" order, meaning that
the "line" DS is #1. I dont know whether this is the reason, but I have seen
strage things happen on forms when the DS's are created in the "wrong" order.
#2
Is your LineNumber field of the correct type? It needs to be a 'real'
DataType and not an integer. Extending or using the existing LineNum DataType
might do the trick.
BaseMachineLine BaseMachineLine;
;
select maxOf(LineNum)
from BaseMachineLine
where BaseMachineLine.OrderId = this.OrderId; // optional link to the parent
table
this.LineNum = BaseMachineLine.LineNum + 1;
Placing similar code in insert() (as suggested in one of the answers)
probably is not a good idea because this field likely to be mandatory, so
validateWrite on the table will fail if record is created on the form.
Regards,
Jack
as Jack sayed earlier...
...overwrite the initValue method on your table.
But you should also override the insert method (and update method) and check
if the LineNum field has a valid value (Could be possible that a user changes
the LinNum field after initalisation).
To not write the same code many times, just place the code to get a new
LineNum (i.e. the code Jack has posted) in a new separate method.
Example:
public LineNum LineNumNext()
{
YourTable buffer;
;
select maxof(LineNum) from buffer
where buffer.ID == this.ID
return buffer.LineNum + 1;
}
In the initValue you have to write something like this:
this.Id = SomeValue;
this.LineNum = this.LineNumNext();
But you have to make sure that your record has the ID Field field befor you
are calling "LineNumNext".
Hope this helps you.
--
Sincerely yours
Axel Kühn (visit my Dynamics AX blog at: http://blog.ak-home.net)
You can see my problem clearly with these link attachment:
http://www.dayza.com/Users-Photos/1254975601.gif
http://www.dayza.com/Users-Photos/1254975631.gif
http://www.dayza.com/Users-Photos/1254975660.gif
http://www.dayza.com/Users-Photos/1254975689.gif
Do you have any ideas for my problem?
--
AX Technical Consultant
Home page: http://erp4vn.net