Wednesday, 23 December 2020

Build your where clause based on the Level 0 Work record fields

 &id = X_TSCRPT_WRK.EMPLID.Value;

&rqst_id = X_TSCRPT_WRK.REPORT_REQUEST_NBR.Value;

rem &sbdt = X_TSCRPT_WRK.SUBMITTED_DT.Value;

&nid = X_TSCRPT_WRK.NATIONAL_ID.Value;

&status = X_TSCRPT_WRK.X_DELIVERY_STATUS.Value;


&WHERE_CLAUSE = " ";

ScrollFlush(Record.X_TRANS_REQ_VW);

If All(&id) Then

   

   &WHERE_CLAUSE = &WHERE_CLAUSE | " EMPLID = '" | &id | "'";

End-If;

If All(&rqst_id) Then

   If All(&WHERE_CLAUSE) Then

      &WHERE_CLAUSE = &WHERE_CLAUSE | " AND " | "REPORT_REQUEST_NBR = '" | &rqst_id | "'";

   Else

      &WHERE_CLAUSE = &WHERE_CLAUSE | " REPORT_REQUEST_NBR = '" | &rqst_id | "'";

   End-If;

End-If;



If All(&nid) Then

   If All(&WHERE_CLAUSE) Then

      &WHERE_CLAUSE = &WHERE_CLAUSE | " AND " | "NATIONAL_ID = '" | &nid | "'";

   Else

      &WHERE_CLAUSE = &WHERE_CLAUSE | " NATIONAL_ID = '" | &nid | "'";

   End-If;

End-If;


If All(&status) Then

   If All(&WHERE_CLAUSE) Then

      &WHERE_CLAUSE = &WHERE_CLAUSE | " AND " | "X_DELIVERY_STATUS = '" | &status | "'";

   Else

      &WHERE_CLAUSE = &WHERE_CLAUSE | " X_DELIVERY_STATUS = '" | &status | "'";

   End-If;

End-If;




If All(X_TSCRPT_WRK.DATE_TO.Value, X_TSCRPT_WRK.DATE_FROM.Value) Then

   If All(&WHERE_CLAUSE) Then

      &WHERE_CLAUSE = &WHERE_CLAUSE | " AND " | "SUBMITTED_DT  between " | Quote(X_TSCRPT_WRK.DATE_FROM.Value) | " AND " | Quote(X_TSCRPT_WRK.DATE_TO.Value);

   Else

      &WHERE_CLAUSE = &WHERE_CLAUSE | "SUBMITTED_DT  between " | Quote(X_TSCRPT_WRK.DATE_FROM.Value) | " AND " | Quote(X_TSCRPT_WRK.DATE_TO.Value);

      

      

   End-If;

End-If;



If All(&WHERE_CLAUSE) Then

   &WHERE_CLAUSE = "WHERE " | &WHERE_CLAUSE;

End-If;

ScrollSelect(1, Record.X_TRANS_REQ_VW, Record.X_TRANS_REQ_VW, &WHERE_CLAUSE);


No comments:

Post a Comment