Opinionated Software

… we have opinions about everything!

Archive for the ‘Peoplecode’ Category

Ceil/Ceiling function in PeopleCode —

I just used the java Math library ceil function from PeopleCode to solve the “round to nearest 0.5” problem e.g. 1 2 3 4 5 6 7 8 9 10 11 Local JavaObject &mathclass; Local number &number_to_round, &result;   /* Instantiate java Math class */ &mathclass = GetJavaClass("java.lang.Math");   For &number_to_round = 0.1 To 2.0 […]

PeopleCode Techniques 1 —

Here is some sample code┬áRowInit PeopleCode: Declare Function BuildHTMLString PeopleCode MY_FUNCLIB.MY_FIELD FieldFormula; BuildHTMLString(GetField(WORK_RECORD.MY_TEXTFIELD), …. some other parameters); The underlying Function is defined as you might expect:   On the surface there is not a lot wrong with this code but it contains a technique that can hurt performance – passing around and using object references […]

RowInit PeopleCode vs Database Logic —

Sometimes you need to do processing logic in RowInit PeopleCode that looks as though it is pretty harmless. But is it? Is RowInit always the correct place to do that logic? Personally, I would nearly always recommend using RowInit PeopleCode as it is the “Peoplesoft Way” and PeopleSoft developers and functional consultants are more familiar […]

Sortable Image Column in PeopleTools Grid —

A quick tip if you want to allow users to sort on an Image column in a PeopleTools grid. Typically this is used in RAG (Red Amber Green) type traffic light images for KPI/target values. The tip is simple but effective: Don’t use an Image column type – use an HTMLAREA and embed a hidden […]

Where you do CreateRowset does matter ….. —

In Peoplecode, it is common to see this construct: 1 Local Rowset &rs = CreateRowset(Record.RECNAME);Local Rowset &rs = CreateRowset(Record.RECNAME); Often, this construct is used within a loop. But this is not a “free” statement – it goes to the database: 1 SELECT {column_list} FROM {tab_name} WHERE 1=2SELECT {column_list} FROM {tab_name} WHERE 1=2 Which, on SQL […]