Sunday, 6 July 2025

SQL to get Long description of Translate Field

 


SELECT A.X_APP_TYPE   

 , B.XLATLONGNAME   

 , A.X_HP_ENTITYID   

 ,A.X_HP_BEARER   

  FROM PS_X_SIS_APP_KEYS A   

  , PSXLATITEM B   

 WHERE B.FIELDNAME = 'X_APP_TYPE'   

   AND B.FIELDVALUE = A.X_APP_TYPE   

   AND B.EFF_STATUS = 'A'   

   AND ( B.EFFDT = (  

 SELECT MAX(A_ED.EFFDT)   

  FROM PSXLATITEM A_ED   

 WHERE B.FIELDNAME = A_ED.FIELDNAME   

   AND B.FIELDVALUE = A_ED.FIELDVALUE   

   AND A_ED.EFFDT <= SYSDATE))

Radio button-like behavior using checkboxes in a grid

 Following PeopleCode  enforces radio button-like behavior using checkboxes in a grid. When the user checks a checkbox in one row of the grid, it will automatically uncheck all others.


/* Place this code in the FieldChange event of X_SELECT */

Local Rowset &rs;

Local Row &row;

Local integer &rowCount;

/* Get the grid rowset */

&rs = GetLevel0().GetRow(1).GetRowset(Scroll.X_STD_INSTLMNTS);


For &i = 1 To &rs.ActiveRowCount

  

   /* Uncheck all other checkboxes */

   If &i <> CurrentRowNumber() Then

      

      &rs(&i).X_STD_INSTLMNTS.X_SELECT.Value = "N";

   Else

      /* Ensure the clicked row is checked */

      &rs(&i).X_STD_INSTLMNTS.X_SELECT.Value = "Y";

      

   End-If;

End-For;


Wednesday, 2 July 2025

Sql.parm Miscount Error in Equations with Callable SQL

 The following occurs when executing an equation engine that uses a callable SQL (with a custom function), or callable SQL contains a custom view 


In Equation Engine, you need to have call parms such that you have 2 more than the number of binds and selected fields - so if you have no binds and
are only returning one field in the select - you would need 3 call parms (1 for sql return code, one for sql row count, one stem to catch the returning
field in your sql). However, if in your select statement in your SQL you use something like a substring function - then the equation will fail when you
test it with an error returned that you don't have the correct number of calls parms.

So, if your sql statement was


SELECT substr(A.STRM,1,2)
FROM ps_session_table


or 

SELECT ITEM_AMT FROM PS_CUSTOM_VW WHERE   EMPLID=:1 AND ADMIT_TERM=:2


You would expect to need 3 bind variables - 2 for sql return codes/row, and a stem to catch the select. However, the equation engine will error your
equation because it is counting each comma in your select as needing a new stem.



The available workaround is to create a TABLE that can be used to simplify the logic of the equation SQL. Insert the data in it and then reference that table instead - using a simpler SQL.

How to Update/Insert on Page Activation

 

Using Begin/End in the SQLExec will get you past the normal PT limitation.



   SQLExec("BEGIN UPDATE PS_PTIAUSERTGTSELS SET DBNAME = '" | &dbName | "' WHERE USERID ='" | %UserId | "'; END;");



     SQLExec("BEGIN INSERT INTO PS_PTIAUSERTGTSELS(USERID, DBNAME) VALUES ('" | %UserId | "', '" | &dbName | "'); END;");