Function DAYSBETWEEN
TABLE OF CONTENTS
- How do I use DAYSBETWEEN?
- Syntax
- Rules for the syntax
- Examples: DAYSBETWEEN function in ERF
- Examples: DAYSBETWEEN function in ECL
How do I use DAYSBETWEEN?
Use DAYSBETWEEN to compare dates and return the difference in days.
DAYSBETWEEN can only be used in Extract Record Filter (ERF) and Extract Column Logic (ECL) text.
Syntax
Rules for the syntax
DAYSBETWEEN can only be used in Extract Record Filter (ERF) and Extract Column Logic (ECL) text.
See also topic: Rules for all Logic Text
Examples: DAYSBETWEEN function in ERF
Example logic text | Meaning |
---|---|
IF (DAYSBETWEEN({field1},{field2}) > 7) THEN SELECT ENDIF |
Select only records where there are more than 7 days between field1 and field2, and skip all other records. This example can also be written: SELECTIF(DAYSBETWEEN({field1},{field2}) > 7) |
Examples: DAYSBETWEEN function in ECL
Example logic text | Meaning |
---|---|
COLUMN = DAYSBETWEEN({BUY_DATE},{SHIP_DATE}) | Set the current column to the days between the transaction date and the shipping date. |
IF (DAYSBETWEEN({BUY_DATE},{SHIP_DATE}) > 10) THEN COLUMN = {SHIP_DATE} ELSE COLUMN = {BUY_DATE} ENDIF |
If there are more than 10 days between the transaction date and the shipping date, then set the current column to the shipping date, otherwise set the current column to the transaction date. |
IF (DAYSBETWEEN({BUY_DATE},{SHIP_DATE}) > 30) THEN WRITE(SOURCE=VIEW,DEST=EXT=03) ENDIF |
Write to Extract 3 those records where there are more than 30 days between the transaction date and the shipping date. |