I need to compose a numerator where one another one has a fixed part that will be id of the user and another one who will be an count, must have this aspect xxxabc001
I need to compose a numerator where one another one has a fixed part that will be id of the user and another one who will be an count, must have this aspect xxxabc001
Why not just add the user ID to the table, and if your Numerator (My Code) is not the primary key then something like:
SETCURRENTKEY("USER ID",My Code");
SETRANGE("USER ID",USERID);
IF FINDLAST THEN
NextMyCode := INCSTR("My Code")
ELSE
NextMyCode := USERID + '001';
Or another option if you are using the user setup table, is to create a field and use a number series for each user and the NoSeriesManagement code unit to return the next number!
with a Starting Number of xxxabc000 then it is easy to change if the requirement changes.
the id is not id of navision is of a new table that I only created for this program. This will go to identify the referring user in the numerator. The first part of the numerator is a field text but fixed it will not go to suffer to alterations the second part will be selected by the people whom the numerator will create and third he will be the accountant who will go being developed consonant its use.
the id is not id of navision is of a new table that I only created for this program. This will go to identify the referring user in the numerator. The first part of the numerator is a field text but fixed it will not go to suffer to alterations the second part will be selected by the people whom the numerator will create and third he will be the accountant who will go being developed consonant its use.
Same Code!
MyRecVariable.SETCURRENTKEY("My User ID",My Code");
MyRecVariable.SETRANGE("My User ID",MyTableUser.ID);
MyRecVariable.IF FINDLAST THEN
NextMyCode := INCSTR(MyRecVariable."My Code")
ELSE
NextMyCode := MyTableUser.ID + '001';
As I said in my last post, I would use the number series, if it is by user then add a field "No. Series" to your new user (Accountant) table, then your code will be like this:
The starting number per user would be Constant + New User ID + 000 = 'xxxaaa000'
This will cause sorting problems due to your structure!
xxxUserA101
xxxUserA104
xxxUserB102
xxxUserB105
xxxUserC103
Consider "Entry No." as a primary key, then a secondary key with the New user ID, and a composite field created on insert, Constant + MyUser.ID+ FORMAT("Entry No.");
Then you can sort as entered or by your composite Field!
Comments
count := 0;
if find ('-') then
repeat
count += 1
until next = 0;
code := FORMAT(count);
Why not just add the user ID to the table, and if your Numerator (My Code) is not the primary key then something like:
SETCURRENTKEY("USER ID",My Code");
SETRANGE("USER ID",USERID);
IF FINDLAST THEN
NextMyCode := INCSTR("My Code")
ELSE
NextMyCode := USERID + '001';
MyRecVariable.INIT;
MyRecVariable."My Code" := NextMyCode;
MyRecVariable."USER ID" := USERID;
MyRecVariable.INSERT;
Or another option if you are using the user setup table, is to create a field and use a number series for each user and the NoSeriesManagement code unit to return the next number!
with a Starting Number of xxxabc000 then it is easy to change if the requirement changes.
David
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com
Rec.SETFILTER(field,xxx);
IF Rec.FINDLAST THEN
BEGIN
newcode := INCSTR(Rec.actualcode);
END;
Maybe it will, maybe it wont?
Same Code!
MyRecVariable.SETCURRENTKEY("My User ID",My Code");
MyRecVariable.SETRANGE("My User ID",MyTableUser.ID);
MyRecVariable.IF FINDLAST THEN
NextMyCode := INCSTR(MyRecVariable."My Code")
ELSE
NextMyCode := MyTableUser.ID + '001';
MyRecVariable.INIT;
MyRecVariable."My Code" := NextMyCode;
MyRecVariable.INSERT;
As I said in my last post, I would use the number series, if it is by user then add a field "No. Series" to your new user (Accountant) table, then your code will be like this:
The starting number per user would be Constant + New User ID + 000 = 'xxxaaa000'
MyTableUser.TESTFIELD("No. Series");
MyRecVariable.INIT;
MyRecVariable."My Code" :=
NoSeriesMgt.GetNextNo(MyTableUser."No. Series",TODAY,TRUE);
MyRecVariable.INSERT;
UserA
xxxUserA001
xxxUserA002
xxxUserA003
UserB
xxxUserB001
xxxUserB002
xxxUserB003
You can use the one number series for all users starting at say 100
MyTableUser.TESTFIELD("No. Series");
MyRecVariable.INIT;
MyRecVariable."My Code" := Constant + MyTableUser.ID +
NoSeriesMgt.GetNextNo(MyTableUser."No. Series",TODAY,TRUE);
MyRecVariable.INSERT;
This will cause sorting problems due to your structure!
xxxUserA101
xxxUserA104
xxxUserB102
xxxUserB105
xxxUserC103
Consider "Entry No." as a primary key, then a secondary key with the New user ID, and a composite field created on insert, Constant + MyUser.ID+ FORMAT("Entry No.");
Then you can sort as entered or by your composite Field!
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com
It will!
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com
I have a problem whit the count