We will Take a EDT name as "Car Id" and create
in number sequence.For that first we should select a module for new number
sequence for example project module.
steps:
1. Create an edt : CarId .
AOT >> Extended Data Types
>> New >> Properties >> Name >> Car Id.
2. Write a code on lode module() on
NumberSeqModuleProject
{
datatype.parmDatatypeId(extendedTypeNum(Car Id));
datatype.parmReferenceHelp(literalStr("@SYS334483"));
datatype.parmWizardIsManual(NoYes::No);
datatype.parmWizardIsChangeDownAllowed(NoYes::No);
datatype.parmWizardIsChangeUpAllowed(NoYes::No);
datatype.parmWizardHighest(999999);
datatype.parmSortField(20);
datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);
this.create(datatype);
}
3.Write a method on
Projparameters Table
client server static NumberSequenceReference numRefcarId()
{
return NumberSeqReference::findReference(extendedTypeNum(car Id));
}
4.Write a job and run
that
static void Carid(Args
_args)
{
NumberSeqModuleProject NumberSeqModuleProject
= new NumberSeqModuleProject();
;
NumberSeqModuleProject.load();
// NumberSeqApplicationModule::loadAll();
}
5. Then run the wizard
Organization
Administration >> CommonForms >>
Numbersequences>>Numbersequences>> Generate >> run the
wizard.
6.Now we have to check
the number sequence is correctly working for that write a job:
static void number(Args
_args)
{
NumberSeq numberSeq;
CarId
num;
;
numberSeq
= NumberSeq::newGetNum(ProjParameters::numRefcarId());
num
= numberSeq.num();
info(num);
}
Run the
above job.We will find the generated Number sequence. .
7. Now we want that
Number Sequence in form level(Car Table):
Declare the number
sequence On Form Declaration:
public class FormRun extends ObjectRun
{
NumberSeqFormHandler
numberSeqFormHandler;
}
8. Write the
NumberSeqFormHandler() in form methods node.
NumberSeqFormHandler
numberSeqFormHandler()
{
if (!numberSeqFormHandler)
{
numberSeqFormHandler
=
NumberSeqFormHandler::newForm(ProjParameters::numRefcarId ().NumberSequenceId,
element,
CarTable_DS,
fieldNum(CarTable, Car Id)
);
}
return numberSeqFormHandler;
}
9.Write the close() on
the form methods node.
void close()
{
if (numberSeqFormHandler)
{
numberSeqFormHandler.formMethodClose();
}
super();
}
10. Then final add the
below methods on data source methods node
Create()
void create(boolean append
= false,
boolean extern = false) // If created externally
{
element.numberSeqFormHandler().formMethodDataSourceCreatePre();
super(append);
if (!extern)
{
element.numberSeqFormHandler().formMethodDataSourceCreate(true);
}
}
Delete()
public void delete()
{
element.numberSeqFormHandler().formMethodDataSourceDelete();
super();
}
Write()
public void write()
{
super();
element.numberSeqFormHandler().formMethodDataSourceWrite();
}
Validate Write()
public boolean validateWrite()
{
boolean ret;
ret
= super();
ret
= element.numberSeqFormHandler().formMethodDataSourceValidateWrite(ret)
&& ret;
if (ret)
{
CarTable.validateWrite();
}
return ret;
}
Link Active()
public void linkActive()
{
;
element.numberSeqFormHandler().formMethodDataSourceLinkActive();
super();
}
No comments:
Post a Comment