Hi All,
How we can create a random number series in a specific format for a particular field in business central ?
Any AL Code logic !
Thanks.
Hi All,
How we can create a random number series in a specific format for a particular field in business central ?
Any AL Code logic !
Thanks.
Is there any way in AL to generate a series for every new record in a particular field. For Ex, I have a field 'Code' in 'Entitlements' page in which I have to generate a series which will be incremented by 1 for every new record
You just use the No. Series Setup and then use No Series management to retrieve the next No. Check the standard code for Sales Order, Customer, Item. You need to add the code in the OnInsert trigger to retrieve the value.
ex:
NoSeriesMgt.GetNextNo('Order Nos.", WorkDate, true); Where Order Nos is the setup field, for that review Sales & Receivables Setup... for the Number Series to Setup.
So, when creating a new record you want to retrieve the next available number of a No. Series?
That's not random :-)
Check function "GetNextNo" of codeunit NoSeriesManagement
I have a field 'code' in which for every new record, unique code in the format 'E0001' should be generated and for every new record this unique code should be incremented by 1
Sorry, but I don't understand your requirement.
Series from E0010 to E9990 is needed to be displayed. Each time, it should be incremented by 1.
Like this?
StartNo := '00001';
Randomize(1);
EndNo := Random(99999);
I want to create a random setup for a new no series for a specific record every time
if you could elaborate your question?
Do you want to create a random setup for a new no series or do you want to retrieve a random number from an existing setup?