Friday 8 October 2021

Auto Increment


Execute this script on database to create the sequence  before using the application where auto increment will require .

drop SEQUENCE  L_DCW_APP_NBR;
CREATE SEQUENCE L_DCW_APP_NBR
 START WITH     1
 INCREMENT BY   1
 NOCACHE
 NOCYCLE; 

----------------------------------------------------------------

You may write the below code on SavePreChange event 

If (%Mode = "A") Then
   SQLExec("SELECT L_DCW_APP_NBR.NEXTVAL FROM DUAL",       L_MINOR_APP_R0.L_DCW_APP_NBR.Value );
End-If;

Thursday 7 October 2021

PS Query output column with multiple values to single column

 try using LISTAGG function in expression part . In my case , one class has more than one instructor and I wanted to show them in one column instead of showing them in more than one row  . 



LISTAGG( '[ ' || rtrim(F.NAME) || ' (' || rtrim(E.INSTR_ROLE)  || ')]'   ,',')  WITHIN GROUP (ORDER BY F.NAME) as InstructorName