hi all,
Actually i am trying to insert the records into the customised Table.
which is in the form of Header and line Format.
while i am inserting a New record in the Line Table It is Taking Negetive line Numbers.
but Line No is an extended Datatype and we set the Property of AllowNegetive to No.
Let me know how to Generate Number series Automatically when ever we Insert a new Record Like Purchase Order creation.
Regards,
ramesh.
0
Comments
Primary key of the line table + datatypes of this fields?
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Hey Kamil, wake up! This is an axapta question... Or do you know axapta as wel?
Sorry... ](*,)
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
I've the same problem bus me I want to be able to insert or remove lines and that that modifies the classification of the following lines.
I've not find the response in any forum of AXAPTA
thank you for your help.
This is easy to do ... supposing you have the 2 tabl;es named HEADER and LINES which are tied through the KEY field, you need to modify 2 methods on the Lines table:
void Insert()
{
Lines customLines;
;
select max(linenum) from customLines where customLines.key = this.key;
this.linenum = customLines.linenum + 1;
super();
}
void delete()
{
int lineNum = this.linenum;
Key key = this.key;
Lines customLines;
;
super();
ttsbegin;
while select forUpdate customLines
order by linenum asc
where customLines.key = key && customLines.linenum > lineNum
{
customLines.lineNum = customLines.lineNum-1;
customLines.Update();
}
ttscommit;
}
Ciprian Dudau
Axapta Developer
Hope this helps.
Ciprian Dudau
Axapta Developer
please correct me but should we setup a NumberSequence for this sort of job ??. and use the NewGetNum method or NewgetNumFromCode to get the next avaliable number ??.
Ciprian Dudau
Axapta Developer
I thank you very much for your answer but unfortunately that doesn't function. Effect I cant use the maxof for the insert. I've to insert lines and that updates the number of the following lines. In example I want to insert a line between the "3" and the "4" the new line must carry the n°4 and "old the n° 4" must as for it carry number 5.
I hope that I was more clearly
I finally found the code which i were to use automatically to increment the numbers of the lines which was superieures with that that I had just created..
public void initValue()
{
MSM_ActiveConfigChoice _ConfigChoice;//form
;
super();
// CUS-Modification on 02 Mar 2006 by ODRT - Begin LineNum insert or create
ttsBegin;
select MaxOf (lineNum) from _configChoice //I selectionne the line highest of my park
where _ConfigChoice.ServiceObjectId == MSM_ActiveConfigChoice.ServiceObjectId ;
if (tmpLineNum == _ConfigChoice.LineNum)// TmpLineNum is my line where i'm in my form
{ //if tmp == maxlineNum tmp+1
MSM_ActiveConfigChoice.LineNum = tmpLineNum +1;
}
else
{
MSM_ActiveConfigChoice.LineNum = tmpLineNum; //my new line take the numlber of the old
while select forupdate _ConfigChoice
where _ConfigChoice.ServiceObjectId == MSM_ActiveConfigChoice.ServiceObjectId &&
_ConfigChoice.LineNum >= tmpLineNum && _ConfigChoice.Statut_C2A == C2A_StatutLigneParc::Actif
//i only selectionne the linenum where are superior
{
_ConfigChoice.LineNum = _ConfigChoice.LineNum +1;
_ConfigChoice.Update();// mise à jour dans ma table
}
}
ttscommit;
// CUS-Modification on 02 Mar 2006 by ODRT - end LineNum insert or create
I hope this code will be useful for you.