I sometimes come across a chunk of PeopleCode that requires a variable be compared to a list of values — like the IN operator in SQL:
If &code = "ABCD" Or &code = "HIJK" Or &code = "OPQR" Then
...
If the condition needs to be checked multiple times within the code and the list changes, there will be some effort required to update the code.
A better coding approach is to use an array and its Find method:
Local array of string &list;
&list = CreateArray("ABCD", "HIJK", "OPQR");
...
If &list.Find(&code) > 0 Then
...
If the list of values changes, only the array will need to be updated.
There is no find method for an array. You have to loop thru the array to find a value,
An alternative is to concatenate the values into a string and use the string find method.
No, it has a Find method.
Hi Joe,
I have a scenario where I need to re-initialize a global variable to blank after clicking the Home link in the PeopleSoft header or after navigating away from the page I’m currently in. Do you know how to do that? Would you know what is the code behind the Home link? Thank you in advance.
Regards,
Khris
Khris, check out the PT_NAV application package. It has the classes used to display the navigation.