Get Involved. Join the Conversation.


    Pooja I
    File name patternAnswered
    Topic posted June 21, 2019 by Pooja IBronze Medal: 1,250+ Points, tagged Adapters, Integration 
    185 Views, 17 Comments
    File name pattern
    File name with date time pattern is not working

    Hi All,

    I am trying to move a file from source FTP location to Target. so when the source file name is "test.txt" i am trying to rename the target with "test_%yyMMddHHmmss%.txt". But the renaming doesn't happen . rather in the target i see, "test_%yyMMddHHmmss%.txt" as file name.

    it was working fine some time ago. But now i am not able to get the right file name in the target.

    Best Comment

    Hemanth Lakkaraju

    Did you type the expression or built it from UI? Once the format-dateTime is dragged and dropped, add a sibling after to the argument shown. Now you will have 2 arguments - 1st one current-dateTime and second one the string expression above.



    • Lakshmi Akkena

      Can you try writing the new file name into tracking variable or log and see what do the OIC tool showing up. If it is showing incorrectly, we can raise SR for the same,

      • Pooja I

        Hi Lakshmi,

           I tried that already, It also posted the same issue. But i believe this feature was working fine and should be working fine. Not sure why its happening all of a sudden.

           I have attached the screenshots of the Map and the related variable. Do let me know if you or any one face the same issue.

        • Monish Munot

          Here we need to provide actual file name and pattern will not work.

          • Pooja I

            I want to archive the files from an SFTP location. So i need to add the timestamp to each of the received files. Is there any way to move a file with adding timestamp to it?

            • Monish Munot

              You can make use of fn:current-dateTime() or fn:current-time() function.

              e.g. concat($fileName, fn:current-dateTime())

              • Pooja I


                   I tried the same and below are the observations:

                "hcm_comm_test_file2019-06-24Z" was the resulting file name if i apply currentDate function

                I get an error when i try to incorporate currentDateTime function because the current time will have colon (9:30:45) As colon is not accepted in filename, i understand that validy of the error.


                However i need to add timestamp in the file name and that's y I had to chose "%yyMMddHHmmss% format.

                Do let me know if you require any other details.


                • Monish Munot

                  You can make use of translate function to replace ':'.

                • Hemanth Lakkaraju

                  Use xp20:format-dateTime as below. Assuming $fileName (abc) is the name of file without extension and $fileExtn is the extension (csv)

                  concat($fileName, '_', xp20:format-dateTime(fn:current-dateTime(), '[Y01][M01][D01][H01][m01][s01]'), $fileExtension)

                  This will give abc_190624162012.csv

                  • Pooja I

                    Hi Hemanth,

                       I tried the way you told.

                    It is failing with :

                    XPath expression failed to execute. An error occurs while processing the XPath expression; the expression is xp20:format-dateTime(fn:current-dateTime(),"[Y01][M01][D01][H01][m01][s01]"). The XPath expression failed to execute; the reason was: oracle.fabric.common.xml.xpath.XPathFunctionException: Xpath20Function Check the detailed root cause described in the exception message text and verify that the XPath query is correct.



                    Also i doubt the format-dateTime function. According to your comment, i can see dateTime is having two parameter

                    but in my version i see only the below

                    xp20:format-dateTime(dateTime as String). the second paramater is missing.Do let me know if this is expected. 




                    • Hemanth Lakkaraju

                      Did you type the expression or built it from UI? Once the format-dateTime is dragged and dropped, add a sibling after to the argument shown. Now you will have 2 arguments - 1st one current-dateTime and second one the string expression above.

                      • Pooja I

                        Hi Hemanth,

                           Thanks to your comments. I was able to format the date. But below are some open items:

                        I am not able to assign X-Path functions to variables and proceed with assigning the variables in the mapper.

                        Sometimes, the mapper after re-updating doesn't updates the newly changed values. 

                        The Xpath functions works fine only in the condition mode of the mapper. while in the expression builder of the assign variables, it throws some error.

                        How to concat more than two variables in the same .

                        Is this possible:



                        Let me know your feedback on this.

                        Thanks a ton!!

                        • Hemanth Lakkaraju

                          To be frank, I could not visualise your problem statement. Screenshots/may be a recording will help to understand. I'm first time hearing 'condition mode' of mapper!!

                          Please note, All functions available in mapper are not supported in expression builder.

                          For concat, If you are constructing expression in mapper - add a sibling after the arguments (once 2 args are filled) to add more arguments. If you are in expression builder, just keep on adding , and then use corresponding argument within braces. You can use any number of arguments in concat.

                          • Pooja I

                            Hi Hemanth,

                            By condition mode, i meant the expression in the mapper.

                            Let me know the functions which are invalid in expression builder. I tried format-dateTime, translate, substring

                            I have attached the expression_builder.png - the expression summary has double quotes for the second expression and i am not able to edit it.(does this quote has to do anything with the way the expression is built?)

                            Mapper has the correct format.


                            Thanks !!



        • Hemen Shah

          can you try this format while using FTP adaptor itself? I used sequence and it worked file. I never tried to use these format using variable.

    • Mani

      not sure why its not accepting %yyMMddHHmmss% for FTP move it it worked in the past. from Oracle documentation I don't see move has the pattern though. you can try download to ICS and then write it to target folder making use of file reference with %yyMMddHHmmss% in name. one if my current integrations does work fine with write operation and it accepts timestamp pattern.