Check Email Address and Type on a PeopleSoft Grid

What I would like to accomplish is every time the user adds a new email address i would want to check for the following:
1. Check for blank email type
2. Edit to check for '@' character
3. Check if email address is blank
4. Check for duplicate email type in the same grid

And here is the PeopleCode on how to do the above:
More...

Local Rowset &RSEmail;

&RSEmail = GetLevel0()(1).GetRowset(Scroll.EMAIL_ADDRESSES);

/* error checks */
For &I = 1 To &RSEmail.ActiveRowCount
/* check for blank email type */
If None(&RSEmail(&I).EMAIL_ADDRESSES.E_ADDR_TYPE.Value) Then
SetCursorPos(%Page, EMAIL_ADDRESSES.E_ADDR_TYPE, &I);
Error MsgGetText(Message Set Number, Message Number, "Email Type is required.");
End-If;

If All(&RSEmail(&I).EMAIL_ADDRESSES.EMAIL_ADDR.Value) Then
/* edit to check for '@' character */
&AT = "";
&AT = Find("@", &RSEmail(&I).EMAIL_ADDRESSES.EMAIL_ADDR.Value);
If &AT = "" Then
SetCursorPos(%Page, EMAIL_ADDRESSES.EMAIL_ADDR, &I);
Error MsgGet(Message Set Number, Message Number, "Email address must contain the @ character.");
End-If;
Else
/* error if email address is blank */
SetCursorPos(%Page, EMAIL_ADDRESSES.EMAIL_ADDR, &I);
Error MsgGetText(Message Set Number, Message Number, "Email Address is required.");
End-If;

/* check for duplicate email type */
&type = &RSEmail(&I).EMAIL_ADDRESSES.E_ADDR_TYPE.Value;
&ROWNUM = &RSEmail(&I).RowNumber;

For &j = 1 To &RSEmail.ActiveRowCount
If &type = &RSEmail(&j).EMAIL_ADDRESSES.E_ADDR_TYPE.Value And
&j <> &ROWNUM Then
/*Alert user that selected email address type has already been chosen*/
SetCursorPos(%Page, EMAIL_ADDRESSES.E_ADDR_TYPE, &j);
Error MsgGetText(Message Set Number, Message Number, "Message not found");
End-If;
End-For;
End-For;

转载于:https://www.cnblogs.com/GoDevil/archive/2009/07/27/1532170.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值