How to set No. Series?

sridharsridhar Member Posts: 171
Hi I want to create a No. field simillar to the No. field in the Customer Card form.

How to set a number series and assign it that particular No. Field?

Can any one please explain the steps..?

Comments

  • ara3nara3n Member Posts: 9,257
    Number series are usually used for primary key fields. You need to be a little clear on what you are want to do. I'm going to assume you are going to create a new table let us call it WebUsers. The primary key of the field is No.
    You need to create a field for the setup where you'll need to grab the right number series. I'm going to put a new field "WebUsers Nos." in Sales & Receivable Setup table. This field will link to number series table.

    Then oninsert trigger of WebUsers I would put the following code.

    NoSeriesMgt as CodeUnit NoSeriesManagement;
    SalesSetup as Record Sales & Receivables Setup

    IF "No." = '' THEN BEGIN
    SalesSetup.GET;
    SalesSetup.TESTFIELD("WebUsers Nos.");
    NoSeriesMgt.InitSeries(SalesSetup."WebUsers Nos.",xRec."No. Series",0D,"No.","No. Series");
    END;


    and onvalidate of No. field

    IF "No." <> xRec."No." THEN BEGIN
    SalesSetup.GET;
    NoSeriesMgt.TestManual(SalesSetup."WebUsers Nos.");
    "No. Series" := '';
    END;


    That's it.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • sridharsridhar Member Posts: 171
    Thanks ara3n,

    Then how we are getting 3 dots at the end of the No. Field in the form..?
  • KowaKowa Member Posts: 925
    sridhar wrote:
    Thanks ara3n,
    Then how we are getting 3 dots at the end of the No. Field in the form..?
    The three dots are always shown if a field textbox is too small to show the whole number on the form. Start the form designer and widen the textbox.
    Kai Kowalewski
  • NavIndiaNavIndia Member Posts: 36
    HI Kowa

    May be i m wrong but I think Sridhar is asking for AssistEdit Button on which u have three dots.

    Sridhar, The three dots is visible if u write a Function on OnAssistEdit Trigger. Actually it is used to provide a option to the user to select the "No. Series" manually....i mean to say when user click on this Assist Button it will open the No. Series Form and user select the No. Series form it.
  • sridharsridhar Member Posts: 171
    Thanks Friends,

    Then I m doing project related to the Financial Module. I want to know in which setup table I have to set the No. Series and how to set it..?
  • ZhiXiangZhiXiang Member Posts: 7
    ara3n wrote:
    Number series are usually used for primary key fields. You need to be a little clear on what you are want to do. I'm going to assume you are going to create a new table let us call it WebUsers. The primary key of the field is No.
    You need to create a field for the setup where you'll need to grab the right number series. I'm going to put a new field "WebUsers Nos." in Sales & Receivable Setup table. This field will link to number series table.

    Then oninsert trigger of WebUsers I would put the following code.

    NoSeriesMgt as CodeUnit NoSeriesManagement;
    SalesSetup as Record Sales & Receivables Setup

    IF "No." = '' THEN BEGIN
    SalesSetup.GET;
    SalesSetup.TESTFIELD("WebUsers Nos.");
    NoSeriesMgt.InitSeries(SalesSetup."WebUsers Nos.",xRec."No. Series",0D,"No.","No. Series");
    END;


    and onvalidate of No. field

    IF "No." <> xRec."No." THEN BEGIN
    SalesSetup.GET;
    NoSeriesMgt.TestManual(SalesSetup."WebUsers Nos.");
    "No. Series" := '';
    END;


    That's it.

    May i know how about cases for those fields which are not primary key?
    :roll: :roll: :roll:
    Nothing is impossible, Impossible is nothing.
  • upasanisandipupasanisandip Member Posts: 405
    I tried code given by ara3n but giving error that


    You have specified an unknown variable.
    No. Series
    Define the variable under Global C/AL Symbols?
  • Miklos_HollenderMiklos_Hollender Member Posts: 1,598
    I think you should explain the business requirement as this thing looks a bit strange.
Sign In or Register to comment.