I have a requirement where I have to generate a .xlsx file appended with Previous day date.
(I have generated the .csv file in output and then converted it into .xlsx file via ssconvert utility)
Here is what I have done...
1. Declared a variable $$FILE_NAME_MPNG
2. Calculating its value in expression transformation like this (Filename should have one day previous date)
variable port: v_fileName --> 'sales_transfers_template_' || TO_CHAR(ADD_TO_DATE(SYSDATE,'DD',-1),'YYYYMMDD')
Created another port of String type as below
TARGET_FILE_NAME --> SETVARIABLE($$FILE_NAME_MPNG,v_fileName)
3. At Session level, in Target properties I have specified output type as Command and in command section I have written this
cat - > $$CarSales_TGT_DIR/sales_transfers_template_`date -d ''yesterday'' '+%Y%m%d'`.csv
4. Created a workflow variable $$FILE_NAME
5. In Component Section --> Post Session Success Command, I have sepcified below command
unix2dos $$CS_TGT_DIR/$$FILE_NAME_MPNG.csv && ssconvert $$CS_TGT_DIR/$$FILE_NAME_MPNG.csv $$CS_TGT_DIR/$$FILE_NAME_MPNG.xlsx
6. In postsession_success_variable_assignment, specified below
All I want is that the value of $$FILE_NAME_MPNG should be calculated via the logic specified in mapping and then in post session success command, its value should be replaced in unix2dos and ssconvert command so that the output .xlsx file will be generated.
But the problem here is that, today I executed the session and If I check the persistent value it would be like below
So When next day I execute my session then It will create the file with name sales_transfers_template_20201221.xlsx but this file is already created today. If I execute the session one more time then it will create the required file sales_transfers_template_20201222.xlsx
Can anyone Please suggest me that what configuration I need to do so that whenever I run the workflow/session, the value of $$FILE_NAME_MPNG should be taken via the logic that has been there in mapping and NOT from the persistent value ?
Or any other approach is also appreciated.