No series to be assigned for three selection = 1, 2 & 3

Hi team,

I wrote the below code on the OnInsert() of my table

,

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

I wrote this on my page action

IF CONFIRM(Text001,FALSE) = TRUE THEN BEGIN
  Selection := STRMENU(CreatingText1,1);
  //Insert ImprestHeader
  ImprestHeader.INIT;
  IF Selection = 1 THEN BEGIN
  ImprestHeader."Advance Type" := ImprestHeader."Advance Type"::"Cash/Purchase Advance";
  ImprestHeader.INSERT(TRUE);
  END ELSE IF Selection = 2 THEN BEGIN
  ImprestHeader."Advance Type" := ImprestHeader."Advance Type"::"Touring Advance";
  ImprestHeader.INSERT(TRUE);
  END ELSE IF Selection = 3 THEN BEGIN
  ImprestHeader."Advance Type" := ImprestHeader."Advance Type"::Imprest;
  ImprestHeader.INSERT(TRUE);
  END;
  PAGE.RUN(52121502,ImprestHeader);
  END;

What to achieve that once select 1 the No: = CA-0000001 and when select 2 the No: = TR - 0000001 why select 3 the No: = IM - 0000001.

But with the above code in my table, was able to get the same no series for the three selection.

Thanks   

Related
Recommended