Archive for July, 2012


Use the “PriorEffDt” function to return the value of the specified field from the record with the prior effective date. This function is valid only for effective-dated records.
Example:
If CURRENCY_CD = PriorEffdt(CURRENCY_CD) Then
      Evaluate ACTION
      When = “PAY”
         If ANNUAL_RT = PriorEffdt(ANNUAL_RT) Then
            Warning MsgGet(1000, 27, “Pay Rate Change action is chosen and Pay Rate has not been changed.”);
         End-if;
         Break;
      When = “DEM”
         If ANNUAL_RT >= PriorEffdt(ANNUAL_RT) Then
            Warning MsgGet(1000, 29, “Demotion Action is chosen and Pay Rate has not been decreased.”);
         end-if;
      When-other
      End-evaluate;
      WinMessage(“This message appears after executing either of the BREAK statements or after all WHEN statements are false”);
   End-if;

While I was working on Incremental Sync EIP’s, I saw this interesting piece of code,referred from Message Class Methods.
CopyRowset
Syntax : CopyRowset(source_rowset [, record_list]);
Description
The CopyRowset method copies data from the source rowset to the like-named fields in the message object executing the method. This is an easy way to populate a message with data from a component.
CopyRowsetDelta
Syntax : CopyRowsetDelta(source_rowset [, record_list]);
Description
The CopyRowsetDelta method copies rows of data that have changed from the source rowset to the like-named records and like-named fields in the message object executing the method.
CopyRowsetDeltaOriginal
Syntax : CopyRowsetDeltaOriginal(source_rowset [, record_list]);
Description
The CopyRowsetDeltaOriginal method copies rows of data that have changed from the source rowset to the like-named records and like-named fields in the message. It also copies the original value of the changed rows.

Example:
   Local Message &MSG;

   &MSG = CreateMessage(Message.DEPT_SYNC);
   &MSG.CopyRowsetDelta(GetLevel0()(1).GetRowset(Scroll.DEPT_TBL), Record.DEPT_TBL, Record.XXX_DEPT_TBL_WK);
   Or
   &MSG = CreateMessage(Message.DEPT_SYNC);
   &MSG.CopyRowsetDeltaOriginal(GetLevel0()(1).GetRowset(Scroll.DEPT_TBL), Record.DEPT_TBL, Record.XXX_DEPT_TBL_WK);

Image

Below code will help us to Change Component properties through JavaScript.

We used it in one of the work units where the requirement was to change “Cancel” button Component property Label to “Return”.

Javascript on HTMLArea:

<script type=”text/javascript”>
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != ‘function’) {
window.onload = func;
} else {
window.onload = function() {
oldonload();
func();
}
}
}
addLoadEvent(function() {
document.getElementById(“#ICCancel”).value = “Return” ;
});
</script>

Recently we had a requirement to include logic in SQL for retrieving employee information.

 Logic:

For populating HIRE Date in a view we need to use below logic:

 If UHC_ACQUISITION_DT is populated use CMPNY_SENIORITY_DT, else if REHIRE_DT is populated use REHIRE_DT.  If neither of those are populated use HIRE_DT

SQL Provided:

SELECT EMPLID , CASE WHEN UHC_ACQUISITION_DT IS  NOT NULL THEN CMPNY_SENIORITY_DT ELSE  CASE WHEN REHIRE_DT IS NOT NULL THEN REHIRE_DT ELSE HIRE_DT END END FROM PS_UHC_PERSONS where  emplid = ‘XXXXXXXXX’