Hi,
In Employee Details we can customize a string field called PAN No.for that field we need some validation.
1.EmplTable --> Add a new string Field named PAN No.
2.Add this field in EmplTable form design.
3.In EmplTable form DataSource -->PAN No-->Modified method .
4.write the following code in modified method
public void modified()
{
EmplTable _emplTable;
;
#define.alphabets('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
#define.numbers('0123456789')
#COSNumbers
if (( EmplTable.PANNO )&&
((strkeep(substr(EmplTable.PANNO, #1, #5), #alphabets) != substr(EmplTable.PANNO, #1, #5)) ||
(strkeep(substr(EmplTable.PANNO, #6, #4), #numbers) != substr(EmplTable.PANNO, #6, #4))
||
(strlen(EmplTable.PANNO) != #10)
||
(strkeep(substr(EmplTable.PANNO, #10, #1), #alphabets) != substr(EmplTable.PANNO, #10,#1))) )
{
Throw error("@GLS5849");
}
select _emplTable where _emplTable.PANNO == EmplTable.PANNO
&& _emplTable.EmplId != EmplTable.EmplId;
if (_emplTable)
{
if(_emplTable.PANNO)
Throw error("PAN Number already exists");
}
super();
}
*****************
create following lable
@GLS5849 = The Permanent Account Number (PAN) must be alphanumeric with 5 alpha, 4 numeric, and 1 alpha characters.
******************
1.EmplTable --> Add a new string Field named PAN No.
2.Add this field in EmplTable form design.
3.In EmplTable form DataSource -->PAN No-->Modified method .
4.write the following code in modified method
public void modified()
{
EmplTable _emplTable;
;
#define.alphabets('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
#define.numbers('0123456789')
#COSNumbers
if (( EmplTable.PANNO )&&
((strkeep(substr(EmplTable.PANNO, #1, #5), #alphabets) != substr(EmplTable.PANNO, #1, #5)) ||
(strkeep(substr(EmplTable.PANNO, #6, #4), #numbers) != substr(EmplTable.PANNO, #6, #4))
||
(strlen(EmplTable.PANNO) != #10)
||
(strkeep(substr(EmplTable.PANNO, #10, #1), #alphabets) != substr(EmplTable.PANNO, #10,#1))) )
{
Throw error("@GLS5849");
}
select _emplTable where _emplTable.PANNO == EmplTable.PANNO
&& _emplTable.EmplId != EmplTable.EmplId;
if (_emplTable)
{
if(_emplTable.PANNO)
Throw error("PAN Number already exists");
}
super();
}
*****************
create following lable
@GLS5849 = The Permanent Account Number (PAN) must be alphanumeric with 5 alpha, 4 numeric, and 1 alpha characters.
******************
No comments:
Post a Comment