Wednesday, January 13, 2016

Grid Label

Starting an entry every now and then that I'm going to call "code dump". Whenever I used or remember to use a common code that I'm sure I'll be using again.

Code dump #1:

GetGrid(Page.UX_DIRECTS_PLT, "<page field name>").GetColumn("<page field name>").Label = "Vacation Balance";

Friday, January 8, 2016

Get Description from Prompt Table

I created a method on App Package to get the description of most commonly used prompt table in HCM. You need to tweak it to work on your purpose.

method GetPromptTableDescr
/+ &fld as Field +/
/+ Returns String +/

Local string &string_descr, &prompt, &fldtype, &fldCd, &cd;
Local Field &recfld;
Local Record &recpr;
Local Rowset &rs;
Local integer &i, &fldlen;

Local boolean &effdtd;

&recfld = &fld;
&cd = &fld.Value;
&fldlen = &recfld.FieldLength;
&fldtype = &recfld.Type;
&prompt = &recfld.PromptTableName;
&recpr = CreateRecord(@("RECORD." | &prompt));
For &i = 1 To &recpr.FieldCount
If &recpr.GetField(&i).IsKey And
&fldlen = &recpr.GetField(&i).FieldLength And
&fldtype = &recpr.GetField(&i).Type Then
&fldCd = &recpr.GetField(&i).Name;
End-If;
/*Added to accomodate EFFDTed Prompts*/
If &recpr.GetField(&i).Name = "EFFDT" Then
&effdtd = True;
End-If;
/*End */
End-For;
&rs = CreateRowset(@("RECORD." | &recpr.Name));
If &effdtd Then
&rs.Fill("WHERE FILL." | &fldCd | " = :1 AND %EffdtCheck(" | &recpr.Name | " FILL_ED, FILL, %CurrentDateIn)", &cd);
Else
&rs.Fill("WHERE FILL." | &fldCd | " = :1", &cd);
End-If;
&string_descr = &rs(1).GetRecord(@("RECORD." | &recpr.Name)).DESCR.Value;
Return &string_descr;
end-method;



Thursday, January 7, 2016

Find your Component!

This SQL helped me a lot and I still use it. Finding Page in PIA is a lot easier now if you have the new releases of PeopleSoft that has SES. But I still find my component using this;

SELECT E.PORTAL_LABEL, D.PORTAL_LABEL, C.PORTAL_LABEL, B.PORTAL_LABEL,
        A.PORTAL_LABEL FROM PSPRSMDEFN A
LEFT JOIN PSPRSMDEFN B ON A.PORTAL_PRNTOBJNAME = B.PORTAL_OBJNAME
        AND A.PORTAL_NAME = B.PORTAL_NAME
LEFT JOIN PSPRSMDEFN C ON B.PORTAL_PRNTOBJNAME = C.PORTAL_OBJNAME
        AND B.PORTAL_NAME = C.PORTAL_NAME
LEFT JOIN PSPRSMDEFN D ON C.PORTAL_PRNTOBJNAME = D.PORTAL_OBJNAME
        AND C.PORTAL_NAME = D.PORTAL_NAME
LEFT JOIN PSPRSMDEFN E ON D.PORTAL_PRNTOBJNAME = E.PORTAL_OBJNAME
        AND D.PORTAL_NAME = E.PORTAL_NAME WHERE A.PORTAL_OBJNAME LIKE '%PROCESSMONITOR%'


Wednesday, January 6, 2016

Hey, I'm back!

I'll be posting again some random PeopleSoft stuff. Some tips and tricks here and there, some complicated, some simple one liner code. To start things off, here's pretty simple code that I used every time I need multiple "OR" in my IF statement;

If CreateArray("ACME", "GOOG", "ORCL").Find(JOB.COMPANY.Value) <> 0 Then
/*Do logic if one of the company above is found. Please take note on the "<>" sign, Find function 
returns 0 if no value match.*/
End-if;