Idoc to file with file name as ABCD timestamp and count

Hi,
Greetings!
I have an requirement like iDoc to File and the output file name should be ABCDYYMMDDXX (e.g ABCD14091701) in PI 7.1
where,
Default = ABCD
YY = year
MM = month
DD = date
XX = sequence no. on the same day; e.g. first batch on same day = 01, second batch on the dame day = 02
I tried checking many blogs but its not meeting this requirement.
Kindly please help me out in completing this interface.
Regards,
Vinoth

Hi Vinoth,
Below is the code. Use it in-conjunction with your dynamic config code.
String inputFile = "D:\\Receiver"; //This is your target receiver folder
  String dateStr = DateFormat.getDateInstance().format(new Date());
  dateStr = dateStr.substring(0, 2)+ dateStr.substring(3, 5)+ dateStr.substring(8,10);
  final String fileNamePattern = "DEFAULT"+dateStr;
  File file = new File(inputFile);
  File[] listFiles = file.listFiles(new FilenameFilter() {
  @Override
  public boolean accept(File dir, String name) {
  if(name.contains(fileNamePattern))
  return true;
  return false;
  //System.out.println("Number of files in the directory "+inputFile+" : Next Counter"+ (listFiles.length+1));
  int counter = listFiles.length+1;
  String fileName = "";
  if(counter < 10)
  fileName = fileNamePattern+0+counter;
  else
  fileName = fileNamePattern+counter;
  System.out.println("Name of the file will be:"+fileName);
Hope it helps!
Best Regards,
Anand Patil

Similar Messages

  • I also have a .csv file with the name of a jpeg in one column and a text description of each jpeg in a second column. Is there a way to automatically insert one jpeg (photo) and its corresponding text, each pair on one page, into a Indesign document?

    I also have a .csv file with the name of a jpeg in one column and a text description of each jpeg in a second column. Is there a way to automatically insert one jpeg (photo) and its corresponding text, each pair on one page, into a Indesign document?

    I would also recommend to write the description into the meta data. This would allow to place a text frame above the image and it is possible to add meta information and file name automatically together with the image, when you place it or even in a prepared template.
    Meta data information can be written easily in Bridge in the Meta File Workspace.

  • How can I see file with chinese name in Sunray USB storage?

    hi, All
    I installed Sunray4u3 on Solaris0805. the application server is win2003EE.
    I accessed usb storage from win2003, but I can only see files with English name , and could not see files with chinese name. Why? who can help?
    best regards
    xiong wei

    You might want to make sure your credit card is listed in the billing information associated with your Apple ID (see http://support.apple.com/kb/ht1918).
    Also, to change the From name that appears when you address emails on and iOS device, go to Settings>Mail,Contacts,Calendars...tap your iCloud email account, tap you iCloud account at the top, tap Mail at the bottom, then enter the name you want to use in the Name field at the top.
    To change the From name on your Mac Mail, go to icloud.com, sign into your account, open Mail, click the gear shaped icon on the bottom left and choose Preferences, go to the Accounts tab and enter the name you want to use in the Full Name field and click Done.  Then quit Mail on your Mac and re-open it.  Your new From name should now appear in the drop-down list when you compose a new email.

  • Live view putting a file with no name

    So i have a problem (don't know if it's a problem really, but at least an annoyance) with the Live View and Preview in browser features.
    When use them, the file transfer window pops up (even if i have told it to stay "hidden") showing the following:
    Started: 29.5.2013 15.47
    index.php - same - not transferred
    Connections:Raspberrypi.php - same - not transferred
    styles:common.css - same - not transferred
    - error occurred - Access denied.  The file may not exist locally,  may be open in another program, or there could be a local permission problem.
    File activity incomplete. 1 file(s) or folder(s) were not completed.
    Files skipped: 3
    Files with errors: 1
    Finished: 29.5.2013 15.47
    So the weird lines are those marked with red. It looks like its trying to put a file with no name or extensions at all - and i don't think i have such files on my site. Also the permissions are correct on both the server and my Mac.
    My web browser opens up and shows the site perfectly, and if I'm using the Live View, the site shows up well too. The thing is every time I hit F5 to refresh, i have to close the file transfer window. Annoying.
    I don't know if it matters but I'm using a Raspberry Pi as my home web server. It has Apache2, PHP 5, MySQL and vsftpd running, and I have been able to use them with no problem earlier.
    Hopefully someone knows what I am doing wrong here...
    Thanks in adnvance!

    Have you enabled Automatic Upload on SAVE?  I never FTP files on Save.  Way too much risk of error and it takes focus away from my work which is very distracting.  See screenshot.
    Nancy O.

  • There is no 'Save as' under the file menu.  How do I save a file with another name?

    Numbers help refers to the 'Save As' function in the File menu.  My version (latest) does not have a 'Save As' function.  How do I save a file with another name?

    Ross Millard wrote:
    Badunit. You have an original file and an edited file. Now you duplicate the edited file and save it with a different name. Now do you have to go and delete the changed file from which the duplicate had been made? And.... is the original still unchaned... still original?
    Ross,
    For the situation you describe, Apple has provided Duplicate and Revert. Use File > Duplicate to reach this menu:
    Regards,
    Jerry

  • Adobe Acrobat Pro cannot find moved files or files with edited names

    Adobe Acrobat X Pro 10.1 cannot find recent files or files with edited names.
    For instance, if a PDF file is moved in the hard disk from one foder to another, Acrobat cannot find it when trying to open it via "File - Open Recent File".
    Likewise, if the name of the file is changed in the Finder.
    Similarly, if a PDF file is open, it is marked with the yellow fluorescent marker of Acrobat, its name is then changed in the Finder and later on you try to save it, Acrobat says that it cannot find such file.
    Yet, applications like Microsoft Word do not have any of the above problems. It would be great if Adobe could fix these serious productivity issues, which have plagued Acrobat for many years now.
    How to send such feedback to Adobe?

    https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform

  • In Pages how do I save a file with another name

    In Pages how do I save a file with another name?

    I don't know if there is a less cumbersome way to do this (I'm still pretty new to Lion) but This is what I do - since "Save As" seems to be gone with Lion.
    I create a duplicate document - then click the red button to close the document - and a dialog box pops up and asks if you want to save the changes - I change the name in there and then save the file under the new name.
    You can also save the copy to the desktop - get info - and then change the name if the finder window.
    I copied this from the Pages help area. These help instructions were created pre-Lion I'm sure.
    Saving a Copy of a Document
    If you want to make a copy of your document—to create a backup copy or multiple versions, for example—you can save the document using a different name or location. (You can also automate saving a backup version, as Automatically Saving a Backup Version of a Document describes.)
    To save a copy of a document: 
    Choose File > Save As and specify a name and location.
    The document with the new name remains open. To work with the previous version, choose File > Open Recent and choose the previous version from the submenu.

  • Problem in loading an external file with unicode name

    Hi,
    I am working on a project which involves loading of an
    external file with unicode name for ex:
    "插入音乐.mp3
    ,插入音乐.jpg". These unicode files are
    loaded successfully when I play/publish the movie with flash player
    alone.
    But when the movie is embedded in to HTML file, it is failing
    to load files with unicode name. this works fine with English name.
    is it a bug? if not pls help.. on this issue
    Thx

    what is your code? so we can get clear picture.

  • How to send file with original name through Mail adapter

    I have to send file with original name as attachment through Mail Adapter. I am picking the file from FTP server through File Adapter. I am not using message mapping because files do not have any standard format.

    Hi,
    Have you solve your problem ?...
    I have exactly the same scenario : pik up a file (file adapter) and send it in attachment by mail adapter without mapping (no IR)...
    I activated Adapter specific paramters properties in the File adapter sender and i can see the FileName tag in DynamicConfiguration section of SoapHeader in SXMB_MONI...
    I want to use MessageTransformationBean... BUT, how can i 'access' to FileName tag ???...
    Thanks...
    I setup modules like this :
    AF_Modules/DynamicConfigurationBean 1
    AF_Modules/MessageTransformBean rename
    sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean mail
    1 key.0 write http://sap.com/xi/XI/System/File FileName
    1 value.0 message.FileName
    rename Transform.ContentDisposition attachment;filename=message.FileName
    rename Transform.ContentDescription message.FileName
    rename Transform.ContentType application/csv-tab-delimited-table;name=message.FileName
    But my file name attachment is message.FileName....
    Edited by: Emmanuel JORAND on Sep 29, 2008 9:23 PM
    Edited by: Emmanuel JORAND on Sep 29, 2008 10:25 PM

  • While saving multiple attachments from mail, files with same name are added and not replaced

    While saving Multiple Attachments from Mail, existing file with same name are not overwritted but new files are added in the folder.

    Bjørn Larsen a écrit:
    Hi all
    Hope to get some help with Elements Organizer.
    I have 12-15 years of digital photos that I now want to import into my newly aquirede Adobe Elements Organizer / Photoshop. Since my Nikon names the files with continous numbers from 0001 to 9999 I have multiple files with the same name although they are not alike at all. My previous software had no problems with that since I keep the photos in separate file folders based on import date. I generally import photos after each event and so name the folder with the date and some event info (e.g. 2014.12.24 - Christmas at grandparents).
    That is a common situation, I have the same limitation for files not going over 9999 on my Canons...
    Now - when I import my photos into Elements Organizer I get a lot of error messages with "same name exist .....) Hmmmmmmm
    Please sate the exact wording of the error message, I have never seen a message stating 'same name exist...' or equivalent; only messages about files already in the catalog. Files already in the catalog mean that some files have the same 'date taken' and file size in Kb.
    Any suggestions. I'm using a mac and tried to rename files based on date taken. The mac can do that but it takes ages to go into each folder and run the renaming script there.
    I also use a similar folder creation scheme (such a date naming is the default for the downloader). That way I never get a message about duplicates for the same file names.
    However - I can't be the first or only person with this problem so I figure that some workaround must be known out there. Maybe the import action can recognize date taken or - well. Thank you very much in advance if you can help me out here.
    You can alsways set the downloader to rename the imported files with a unique new name, there are many options in the 'advanced' dialog of the downloader. I don't know about Macs, but I don't thing there is a difference.

  • Spotlight/Finder can't find a file, yet when I search the timecapsule for they find it. If I try to restore the file I get "file with that name already exists...." What is wrong?

    I was trying to find a file (iTunes Backup). When using finder/Spotlight they couldn't find the file.
    I then opened up my timecapsule and searched for the file....tick-a-de-da it found it in yesterdays backup. I attempted to restore the file and got the prompt "A file with that name already exists in this location, would you like to keep both, replace the file or cancel the request.
    So if the file is there why can't spotlight/finder find the file??
    If it helps I get this from the terminal when checking if indexing was enabled.
    $ mdutil -s -a
      Indexing enabled.
    /Volumes/Data:
    2014-11-18 18:09:39.542 mdutil[1472:572531] Metadata.framework [Error]: mdsCopyStoreAttributes failed: (8) (os/kern) no access
      No index.
    /Volumes/Time Machine Backups:
      Indexing and searching disabled.
    /Volumes/Time Machine Backups/Backups.backupdb:
      Indexing enabled.

    Hi Danielle,
    Is there any possibilty that some of your files (a VI or DLL?) have been moved, renamed, or deleted? Also, what version of LabVIEW are you using and are you using any .NET DLLs? Another option to consider would involve VISA or DAQmx property nodes. Are you using any of these property nodes in your code? Here is a KnowledgeBase article to describe more about the VISA and DAQmx property nodes in a source distribution:
    Error Creating Source Distributions Involving rc Files: http://digital.ni.com/public.nsf/allkb/833BFD5E9CA0224886257584004DAA4C?OpenDocument
    I hope this is able to help.
    Anna L
    Applications Engineer
    National Instruments

  • "File with specified name and version number already exists. Result code= -48."   ...????

    Recently I have been getting this error message when I try to record an audio track in Logic... "File with specified name and version number already exists. Result code = -48."  WHAT IS THE PROBLEM?????? It's making me furious!

    Hi
    As the message says, there is a file at the recording directory that has the same name:
    http://support.apple.com/kb/ht1618
    Try changing the name of the track (this sets the filename in later versions of Logic 9
    CCT

  • Files with "alien" names in directories with very long path names

    Hi all,
    first of all - I dont know if this is the right forum for my Question,
    but I could not find any better ;-)
    I have a problem with some files with "alien" names with MIXED characters from different foreign countries
    (e.g. "Φέτα (τυρί) 只有沙盒或您的用户页可以用作測試ורת המבחנים בחינוך פור.txt").
    Sometimes - whenn those files are exists in a directory with a very long path name,
    then the windows api fails to handle these files.
    For example GetFileAttributesW() returns error 2
    and ntQueryDirectoryFile does not return this file in the list (etc. pp.)
    I have this behaviour not with other files in those directories (e.g. "abc.txt")
    and also not when those names are a little bit shorter
    or the directorys name is not too long.
    So I guess, there is a bug either in the API or in the file system...?!
    I know that such a file name is a generic one,
    but I have a situation where I have to handle any file with any name -
    even in directories with very long path names...
    So please no suggestions like "use shorter paths" or "convert it to a short name"....
    thx in advance and Best regards,
    dp.

    No need to call, your MSDN subscription has few free support incidents.
    Chat with the rep to submit an incident.
    Or find their phone number
    here.
    Good luck,
    -- pa

  • How to delete one existing file before uploading a file with same name?

    Hello everybody.
    I am uploading a file to Tomcat server. But, the problem is:
    i want to delete an existing file in the server, if i upload a fresh file with same name. In other words, "First check for the file with the same name in the server. If it exists, then delete existing file in the server and upload fresh one". If such file doesnot exist, then upload the file to server.
    I have given deleteonExit()
    but, for the first time when user is uploading, i want to check for the file with same name in the server.
    i am pasting the code here. please help:
    <!-- uploading the file -->
    <%
    String contentType = request.getContentType();
    if ((contentType != null) && (contentType.indexOf("multipart/form-data") >= 0))
    DataInputStream in = new DataInputStream(request.getInputStream());
    int formDataLength = request.getContentLength();
    byte dataBytes[] = new byte[formDataLength];
    int byteRead = 0;
    int totalBytesRead = 0;
    while (totalBytesRead < formDataLength)
    byteRead = in.read(dataBytes, totalBytesRead, formDataLength);
    totalBytesRead += byteRead;
    String contextRootPath = this.getServletContext().getRealPath("/");
    contextRootPath=contextRootPath.concat("uploaded");
    String file = new String(dataBytes);
    String saveFile = file.substring(file.indexOf("filename=\"") + 10);
    saveFile = saveFile.substring(0, saveFile.indexOf("\n"));
    saveFile = saveFile.substring(saveFile.lastIndexOf("\\") + 1,saveFile.indexOf("\""));
    // Create a directory; all ancestor directories must exist
    File outputFile = new File(contextRootPath, saveFile);
    var=outputFile.getPath();
    outputFile.createNewFile();
    int lastIndex = contentType.lastIndexOf("=");
    String boundary = contentType.substring(lastIndex + 1,contentType.length());
    int pos;
    pos = file.indexOf("filename=\"");
    pos = file.indexOf("\n", pos) + 1;
    pos = file.indexOf("\n", pos) + 1;
    pos = file.indexOf("\n", pos) + 1;
    int boundaryLocation = file.indexOf(boundary, pos) - 4;
    int startPos = ((file.substring(0, pos)).getBytes()).length;
    int endPos = ((file.substring(0, boundaryLocation)).getBytes()).length;
    FileOutputStream fileOut = new FileOutputStream(outputFile);
    fileOut.write(dataBytes, startPos, (endPos - startPos));
    fileOut.flush();
    fileOut.close();
    outputFile.deleteOnExit();
    %>Please help. Thanks for taking time.
    Regards,
    Ashvini

    Thank you MartinHilpert,
    I have one more doubt,
    I am uploading the file to one folder called "uploaded". Before uploading a fresh file, i want to delete all existing files in that folder. IS that possible ?? If yes, can you please tell me how to do that ??
    Regards, Thanks for your time.
    Ashlvini

  • You already have a schema opened on this file with another name: abc

    I am trying to create a model for an XML file, when I clicked on "Objects to Reverse" checkbox under "Selective Reverse" tab, I am getting the following error:
    java.sql.SQLException: You already have a schema opened on this file with another name: abc
    I have created a Data Server in Topology whose schema and workschema are "abc" and logicla schema is "Labc".
    Where is the mistake going in?

    That is because you can only connect to a file in read/write mode once at a time. When you connect to a file without specifying ro=true (e.g. Read Only=true) in the URL, the file is locked and you can’t connect to the file from another instance until the original connection is dropped. I assume since you are trying to connect to the file multiple times that you mean to connect in readonly mode. To do this, like I mentioned earlier, simply add ro=true to your URL and you should be all set. Note: you may need o restart your JVM for chnges to take effect. Let me know if that works.

Maybe you are looking for