line number creation

b2bteam
Member Posts: 4
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.
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
-
Negative lines no? Please, can you send us:
Primary key of the line table + datatypes of this fields?0 -
kine wrote:Negative lines no? Please, can you send us:
Primary key of the line table + datatypes of this fields?
Hey Kamil, wake up! This is an axapta question... Or do you know axapta as wel?0 -
-
hi,
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.0 -
Hi,
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;
}Kind regards,
Ciprian Dudau
Axapta Developer0 -
Also, in order to see the lines correctly in the bottom section grid of your form, you need set on the Lines datasource the CounterField property to Linenum (or whatever the counter field name is).
Hope this helps.Kind regards,
Ciprian Dudau
Axapta Developer0 -
Hi Mugur.
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 ??.0 -
No, the number sequence have nothing to do with line numbering. Number seq's are used for primary key's generation, and only when those are strings. AFAIK, nowhere in Axapta the linenum is generated as you expect.Kind regards,
Ciprian Dudau
Axapta Developer0 -
hi Mugur,
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 clearly0 -
hi,
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.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions