PeopleSoft-警告、错误、消息盒子

PS页面中配置提示消息路径:

根据消息严重性不一样,会有不同的结果。1.取消;2.消息;3.警告;4.错误;不同的消息,程序会根据不同的严重性进入不同的步骤(MsgGet、MsgGetExplainText对此方法无效,仅对Messagebox有效)。

  • 显示消息并且强制取消程序;
  • 显示消息并继续处理;
  • 显示消息并视为警告;
  • 显示消息并视为错误;

Messagebox、winMessage类在以下类型中不回被触发;

  • SavePreChange.

  • Workflow.

  • RowSelect.

  • SavePostChange.

  • Any PeopleCode event that fires as a result of a ScrollSelect (or one of its relatives) function calls, or a Select (or one of its relatives) Rowset class method.

Messagebox

1
2
3
4
5
6
7
8
9
10
11
12
MessageBox(style, title, message_set, message_num, default_msg_txt[, paramlist]);

MessageBox(0, "", 1, 2, &String);
/*
"0"是buttons,类型详情参考下标;
""在web服务中会被忽略;
"1"是PS中的消息集合编号;
"2"是PS中的消息编号;
"&String"是找不到消息集合编号&消息编号时,会默认提示该内容;
"[paramlist]"会动态替换【消息目录页面】的【消息文本】、【详细描述】两个字段中的动态字段 %X ;
注意:会根据消息的【严重性】来进行程序执行与否!!
*/
  • messagebox不同buttons类型:
Category Value Constant Meaning
Buttons 0 %MsgStyle_OK The message box contains one push button: OK.
1 %MsgStyle_OKCancel The message box contains two pushbuttons: OK and Cancel.
2 %MsgStyle_AbortRetryIgnore The message box contains three pushbuttons: Abort, Retry, and Ignore.
3 %MsgStyle_YesNoCancel The message box contains three pushbuttons: Yes, No, and Cancel.
4 %MsgStyle_YesNo The message box contains two push buttons: Yes and No.
5 %MsgStyle_RetryCancel The message box contains two push buttons: Retry and Cancel.
  • messagebox不同buttons类型的返回值(数值型):
Value Constant Meaning
-1 %MsgResult_Warning Warning was generated.
1 %MsgResult_OK OK button was selected.
2 %MsgResult_Cancel Cancel button was selected.
3 %MsgResult_Abort Abort button was selected.
4 %MsgResult_Retry Retry button was selected.
5 %MsgResult_Ignore Ignore button was selected.
6 %MsgResult_Yes Yes button was selected.
7 %MsgResult_No No button was selected.

winmessage

1
2
//一般用于调试测试使用;
winmessage("用于调试");

Warning

1
2
3
4
5
6
7
8
//一般在报表中使用警告;
Warning("警告内容是啥呢~~");
//直接提示默认内容
//不会中断程序;
Warning MsgGet(1000, 1, &String);
/*
"1000"PS中的消息集合编号,"1"是PS中的消息编号;"&String"是找不到消息集合编号&消息编号时,会默认提示该内容。
*/

Error

1
2
3
4
5
6
7
Error("错误内容是啥呢~~")
//直接提示默认内容
//会中断程序;
Error MsgGet(11100, 180, &String);
/*
"11100"PS中的消息集合编号,"180"是PS中的消息编号;"&String"是找不到消息集合编号&消息编号时,会默认提示该内容。注意不能与MsgGetExplainText 同时使用,否则页面会提示两条信息!
*/

MsgGet

1
2
3
//无论消息的严重性如何,只做获取消息;
&MsgText = MsgGet(30000, 2, "Message not found","动态参数1","动态参数2","动态参数3");

MsgGetExplainText

1
2
3
4
5
6
//无论消息的严重性如何,只做获取消息;获取消息的同时,可以动态替换消息内容;
&MsgText = MsgGetExplainText(message_set, message_num, default_msg_txt[, paramlist])
/*
"[paramlist]"会动态替换【消息目录页面】的【详细描述】字段中的动态字段 %X ;
注意:【消息文本】中不能出现动态参数,否则会找不到消息!!!不能于error同时使用,否则页面会提示两条信息!
*/

注意

​ MessageBox、Warning、winmessage函数不会终止程序;Error会终止程序。当然,根据选择的不同的消息严重性也会结果不同,例如:MessageBox采用的消息如果严重性时取消或者错误,也会终止程序。

一切内容以PeopleBook中的内容为准:

PeopleBook8.57