1. Get the description of the translate value:

No need to write SQLEXEC on PSXLATITEM passing fieldname and Field value. Just use LongTranslateValue property to get the long description of the field as: 

Local Any &VALUE; 
Local Field &MYFIELD;

&MYFIELD = GetField(); 
&VALUE = &MYFIELD.LongTranslateValue; 

If the field has a null value, a null string is returned. If the field isn’t based on a translate table, or the value isn’t in the translate table, the field’s current value is returned. Because the current value can be of any type, this property has a type of Any.

In the same way we can use the ShortTranslateValue property to return the short description of a translate value of a field.

2. Hide/Unhide the asterisk(*) on required fields:

You have made some field as required in record field property but don't want that asterisk to appear with field.

In this case just use the property ShowRequiredFieldCue and make that true or false to show or hide that asterisk (*, also known as required field cue). 

Local Field &MYFIELD; 
&MYFIELD.ShowRequiredFieldCue = False; 

One thing to be remembered here is that no cue is ever shown on a pushbuttons or display-only fields.

3. Getting or checking the field type in peoplecode:

If you wish to get the type of a field or want to write peoplecode and want to write the conditional statement based on the type of the field then the type property can be used there.

This property returns the type of field. And peoplecode may be written as: 

Local Field &MYFIELD;

If &MYFIELD.Type = "CHAR" Then 
--- processing logic --- 
Else 
--- processing logic --- 
End-If; 

The returned value from type property can be one of the following strings:

1. CHAR 
2. DATE 
3. DATETIME 
4. IMAGE (for static images) 
5. IMAGEREFERENCE 
6. LONGCHAR 
7. NUMBER 
8. SIGNEDNUMBER 
9. TIME

Note. Fields of type Attachment have a type of IMAGE. Remember that This property is read-only and you can only get the return value of type string.

4. Increment the key (Request ID/Transaction Number/....) and get from database:

Very common requirement, many times while saving a new transaction we run SQLEXEC on database, get the highest key value and increment it by one and save a new row with that key.

Why to run query and do this mathematics if we can do this by using GetNextNumber peoplecode functions?

Use GetNextNumber function to increment the value in a record for the field you specify by one and returns that value. If the new value generated exceeds max number which is specified as second parameter, a negative value (-1 or -2 or -3) is returned and the field value isn't incremented. 

&Val = GetNextNumber(RECORD.FIELD, 99999999); 

An evaluate can be written after that to error handling or default processing as: 

Evaluate &Val 
When = %GetNextNumber_SQLFailure 
-- do processing -- 
When = %GetNextNumber_TooBig 
-- do processing -- 
When = %GetNextNumber_NotFound 
-- do processing -- 
When-other 
-- do default processing using &Val -- 
End-Evaluate; 

5. Expand or collapse a groupbox/scroll using peoplecode:

This is required when we want to display or hide the fields in groupbox on page organized in different groups using hyperlink or button.

For this we can use DataAreaCollapsed property and functionality can be achieved by setting this property to true or false.

One thing to remeber is that you must set the group box as Collapsible Data Area on the page field properties for the group box in PeopleSoft Application Designer before you could this property.

To collapse (Hide): 
&TEST1.DataAreaCollapsed = True;

To expand (show): 
&TEST1.DataAreaCollapsed = False;

Here &TEST1 can be either a collapsible group box or scroll area.

一些peoplecode小技巧【一】的更多相关文章

  1. 一些peoplecode小技巧平【二】

    1. Set component changed page field property: For understanding this open a page in application desi ...

  2. 前端网络、JavaScript优化以及开发小技巧

    一.网络优化 YSlow有23条规则,中文可以参考这里.这几十条规则最主要是在做消除或减少不必要的网络延迟,将需要传输的数据压缩至最少. 1)合并压缩CSS.JavaScript.图片,静态资源CDN ...

  3. Git小技巧 - 指令别名及使用Beyond Compare作为差异比较工具

    前言 本文主要写给使用命令行来操作Git的用户,用于提高Git使用的效率.至于使用命令还是GUI(Tortoise Git或VS的Git插件)就不在此讨论了,大家根据自己的的喜好选择就好.我个人是比较 ...

  4. 分享两个BPM配置小技巧

    1.小技巧 流程图修改后发布的话版本号会+1,修改次数多了之后可能会导致版本号很高,这个时候可以将流程导出,然后删除对应的流程包再导入,发布数据模型和流程图之后,版本清零 2.小技巧 有的同事入职后使 ...

  5. linux系统维护时的一些小技巧,包括系统挂载新磁盘的方法!可收藏!

    这里发布一些平时所用到的小技巧,不多,不过会持续更新.... 1.需要将history创建硬链接ln 全盘需要备份硬链接 ln /etc/xxx /home/xxx 2.root用户不可以远程 /et ...

  6. JS处理事件小技巧

    今天,就分享一下我自己总结的一些JS的小技巧: ①防止鼠标选中事件 <div class="mask" onselectstart="return false&qu ...

  7. iOS:小技巧(不断更新)

    记录下一些不常用技巧,以防忘记,复制用. 1.获取当前的View在Window的frame: UIWindow * window=[[[UIApplication sharedApplication] ...

  8. css小技巧(1)

    1.-webkit-overflow-scrolling: touch; 解决ios滑动时无缓冲问题 2.::-webkit-scrollbar 设置ios滑动时是否显示滚动条 3.::selecti ...

  9. 最强 Android Studio 使用小技巧和快捷键

    写在前面 本文翻译自 Android Studio Tips by Philippe Breault,一共收集了62个 Android Studio 使用小技巧和快捷键. 根据这些小技巧的使用场景,本 ...

随机推荐

  1. 无侵入方面编程-用HttpModule+SoapExtension监视页面执行参数(一)

    先简单介绍一下项目吧,我们这个项目是用VS2003开发的,老早一个项目.WEB前端机+业务处理(WebService层)+数据库分别布置在不同的计算机上. 现在老总有一个需求,要统计出每个页面的执行时 ...

  2. 怎么查询局域网内全部电脑IP和mac地址等信息?

    在局域网内查询在线主机的IP一般比较简单,但局域网内全部电脑的IP怎么才能够查到呢?查询到IP后我还要知道对方的一些详细信息(如MAC地址.电脑名称等)该怎么查询呢??? 工具/原料 Windows ...

  3. struts (七) 域模型

    1.域模型获取参数 domain Model 2. vo  value object  值对象 do  data object 数据对象 dto data transfer object  数据传输对 ...

  4. SparseArray,dip & px

    SparseArray-用Array的方式实现Integer-Object的map 优:节约内存,因为避免了装箱/拆箱,数据结构不依赖Entry 劣:速度不及HashMap dip.px dip(de ...

  5. Hadoop JobHistory

    hadoop jobhistory记录下已运行完的MapReduce作业信息并存放在指定的HDFS目录下,默认情况下是没有启动的,需要配置完后手工启动服务. mapred-site.xml添加如下配置 ...

  6. Jmeter如何设置断言

    1.打开飞机订票网站,登录后,确定要查找的关键字为reservation :2.在录制的登录脚本里,添加察看结果树监听器:3.运行一遍脚本:4.在察看结果树里查找reservation文本,并定位页面 ...

  7. 同步灵无线锂电鼠G11-580HX独特“五灵键”

    http://tieba.baidu.com/p/2130455709 现在鼠标功能越来越强大,游戏鼠标的宏设置,办公鼠标的复制粘贴等.各位有没有给鼠标设置一些好玩.方便.搞怪.有意思的的功能的呢?笔 ...

  8. OpenJudge 取数游戏

    描述 我们来玩一个游戏:自然数1到N,按顺序列成一排,你可以从中取走任意个数,但是相邻的两个不可以同时被取走.如果你能算出一共有多少种取法,那么你会被天神Lijiganjun奖励. 输入 仅包含一个数 ...

  9. JSTL的全称:JSP Standard Tag Library, jsp 标准标签库

    JSTL的全称:JSP Standard Tag Library, jsp 标准标签库 JSTL的作用     提供给Java web开发人员一个标准通过的标签函数库和EL来取代传统直接在页面上嵌入j ...

  10. haproxy配置文件简单管理

    版本:python3功能:对haproxy配置文件进行简单的查询.添加以及删除功能操作流程:1.根据提示选择相应的选项2.进入所选项后,根据提示写入相应的参数3.查询功能会返回查询结果,添加.删除以及 ...