Pass Dynamic Value to a Grid Label

 A grid label is the blue (normally) colored grid header that you see on PeopleSoft pages. The grid text label can be easily edited using the Grid Properties in app designer. Once you have the grid properties box open, click the Label tab > Properties and there you can see the Label Text area. You can choose between a Static Text type or Message Catalog. I would almost always go with Message Catalog type as this could be easily updated online.

Now, what if you would like to have a part of the grid label text to be dynamic. For example, you want the grid on the Self Service Phone Numbers page to say "Phone Numbers for some user" instead of just "Phone Numbers". Step one:

Create your message catalog. Mine is (25000, 5) and at the subject line I entered "Phone Number for %1". The %1 will be later substituted with the user name accessing his/her self service.(%1是等待传入参数,可传入多个)

Step two: Open the phone numbers self service page in app designer and double click on the grid > Label tab > click 1st properties button (Header Area - Display title) > Type = Message Catalog > enter your Message Set/Number.

Step three:

Add the following code to your page activate event. (pageactivate事件用于处理page中的控件显示属性之类)

Declare Function get_person_name PeopleCode FUNCLIB_NAME.PERSON_NAME FieldFormula; /* this line might already be there but this is needed if you are working on a custom page*/  &GRID = GetGrid(Panel.HR_PERSONAL_PHONE, "PERSONAL_PHONE"); /* This function converts the name to a user friendly format */ &Name = get_person_name(%UserId, "", "", "");

&GRID.Label = MsgGetText(25000, 5, "Message Not Found", &Name);

上一篇:Pathon学习笔记1


下一篇:Python 脚本碎片