Subject | Re: Get duplicate generator value? Am I doing wrong? |
---|---|
Author | bigredinf |
Post date | 2005-04-02T02:07:56Z |
> Given that your calculation causes the generated number, at its currentif you
> order, to shed the first digit, you would start getting duplicates
> spun more than 9999 numbers of this generator in a single month.I understand,But I can sure my client won't key over 2000 records
within 1 month. so I used this structure lotno.
If you
> lost generator numbers for some reason during that month, the maximumduplicates
> number of potential lot numbers might be considerably less than the
> supposed 9999.
> I don't see where "2 hours" fits in. You will begin producing
> if you use up more than 9999 generated numbers in one calendar month.I check the data on firebird, the later one record with same
lotno value was inserted after first one by 120 minuts,
and there is not other record inserted into the table within
that period.
So I donot think there will happen
10000 genertor call and not insert one record into table
in thar "120 minutes" period.
>method of
> Since you are using IBO, you have no need for your complicated
> getting the generator value: use the Gen_ID() function:'25418'
>
> function afgetNewNo_str(pddate: tdate):
> string;
> begin
> Result := IntToStr(IB_Connection1.Gen_ID(gn_lotno,1)); // returns
> Result := FormatDateTime('yymm', PDDATE)If my client have such loading
> + copy(Result, (Length(Result) - 3), 4);
> // produces '05035418'
> end;
>
> But I think you need to add two characters to the length of LotNo and
> include the day part of the date in your string.
(over 1000 records per day) ,I will take this advice.
Thank you for your quick reply.
Kadee/Bigredinf