Ever wanted to run a PS Query and view results by clicking a Push button/hyperlink ? The following code snippet does just that. However, my example involves running a query in PeopleSoft FSCM 9.2 by clicking a Push-button in PeopleSoft HCM 9.2. 🙂
You can write the following code in the FieldChange event of your push-button/hyperlink.
/* The PS Query that I need to run takes EmplID, Empl Rcd, Start date and End date as parameters */ Local string &emplid, &emplRcd, &startDt, &endDt; /* Fetch values from source page */ &emplid = SAMPLE_WRK.EMPLID.Value; &empl_Rcd = SAMPLE_WRK.EMPL_RCD.Value; &startDt = SAMPLE_WRK.START_DT.Value; &endDt = SAMPLE_WRK.END_DT.Value; REM Generate PS QUery URL; &queryURL = GenerateQueryContentURL(Portal."EMPLOYEE", Node."ERP", "EMPL_QRY", True, True); REM Pass Bind values to PS QUery; &queryBind = String("&BIND2=" | &startDt | "&BIND3=" | &endDt | "&BIND4=" | &emplid | "&BIND5=" | &empl_Rcd); REM Run Query and open results in a new browser window; ViewURL(&queryURL | &queryBind, True);
&BINDn is the unique name assigned to each Bind value in a PS Query.
The code generates an URL for the PS Query and passes Bind values as parameters in the URL. Ensure that startDt or any date variable being passed as prompts for that matter should be in the format: YYYY-MM-DD . And, none of the parameters should be enclosed within double quotes.
Have fun! 🙂
If you have multiple Bind values, concatenate them using &BIND