GetEffectiveItemNum method: Data collection
Syntax
GetEffectiveItemNum(DateString, SeqNo)
Description
If the component associated with the Component Interface is effective-dated, GetEffectiveItemNum returns a reference to the number of the closest effective-dated item (row of data) that is less than or equal to the date specified by the DateString. To get an item number based on the current effective date, use CurrentItemNum.
Note:
DateString takes only a string value. You must convert a date variable into a string before you can use it for DateString. You can use the String function to do this.
Parameters
| Parameter | Description |
|---|---|
|
DateString |
Specify the year, month, and day of the effective date that you want to look for. This parameter takes a string value. You can specify the date either as YYYY-MM-DD or MM/DD/YYYY. |
|
SeqNo |
Specify the sequence number of the effective date that you want to look for. This parameter takes a number value. |
Returns
A number. This method returns 0 if no row matching the criteria is found.
Example
&MYCD = &MYCI.EMPL_CHKLST_ITM;
&DSTRING = String(&MYDATE);
&ITEMNUM = &MYDC.GetEffectiveItemNum(&DSTRING, 1);
Considerations for Returning Rows
GetEffectiveItemNum returns a valid row number only when EFFDT is less than or equal to DateString. If the value you use for DateString pre-dates all the rows in the data collection, this method returns a zero and logs a message in the PSMessages collection.
For example, if 12/01/1990 was the earliest date in the collection, the following would return zero:
&NUM = &MYDC.GetEffectiveItemNum("01/01/1900", 1);
Related Topics