Use Case:
In Oracle Integration Cloud (OIC), we need to list files from an source SFTP server based on a specific filename pattern and a date in the format YYYYMMDD
. This date should be passed as a parameter to support both:
- Scheduled Runs – Using the current date dynamically.
- Ad-hoc or Past Date Processing – Allowing users to specify any past date manually.
This flexibility ensures that integrations can process files efficiently, whether through automated schedules or on-demand executions.
Date validation condition:
(((FileProcessingDate = 'YYYYMMDD') or (FileProcessingDate = '')) or (FileProcessingDate = format-dateTime(concat(substring(FileProcessingDate, 1, 4), '-', substring(FileProcessingDate, 5, 2), '-', substring(FileProcessingDate, 7, 2)), '[Y0001][M01][D01]')))
File pattern population logic:
When processingdate != 'YYYYMMDD' and processingdate != ''
replace(lookupValue("Common_CCS_Interface_SFTP_Lookup", "IntegrationId", Var_InterfaceId, "SourceFileName", "CTFCLPMC*"), "YYYYMMDD", FileProcessingDate)
Otherwise:
replace(lookupValue("Common_CCS_Interface_SFTP_Lookup", "IntegrationId", Var_InterfaceId, "SourceFileName", "CTFCLPMC*"), "YYYYMMDD", format-dateTime(current-dateTime(), "[Y0001][M01][D01]"))
Solution Steps:
- Create a Scheduled Orchestration integration pattern to enable both scheduled and manual triggers.
- Define a schedule parameter fileprocesingDate (YYYYMMDD format) to accept the date dynamically.
- Validation: add a throw new fault and put the skip condition, if invalid date, it will throw error. Skip conditions:
- Procrssing date is YYYYMMDD
- Processing date is empty
- File processing is in YYYYMMDD format.
- Configure the sftp adapter and choose list files operations and put the following branching to populate the right file name pattern.
- When processingdate is not YYYYMMDD and not empty, take file name part and current date from the schedule parameter for adhoc run.
- Otherwise, take the name and current date for automatic processing.
- Take the list of files and process one by one using a for each loop
- If no files found, send a notication or log an appropriate message.
- Procrssing date is YYYYMMDD
- Processing date is empty
- File processing is in YYYYMMDD format.
- When processingdate is not YYYYMMDD and not empty, take file name part and current date from the schedule parameter for adhoc run.
- Otherwise, take the name and current date for automatic processing.
Testing & Deployment
- Test with multiple scenarios:
- Scheduled execution with the current date.
- Manual execution with a specific past date.
- Scenarios where no matching files exist.
- Deploy the integration and configure scheduling as per business needs.
No comments:
Post a Comment