How To Display File Name Inside Form? - InfoPath Dev
in

InfoPath Dev

How To Display File Name Inside Form?

Last post 06-14-2009 10:34 PM by warrtalon. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 06-10-2009 08:36 AM

    How To Display File Name Inside Form?

    I am dynamically creating an autonum file name for my InfoPath forms (using this method). ... let's say it is PO-00394 

    After the form is submitted (when the user hits "View 2") I would like to display the file name (PO-00394) on the form.  How can I achieve that without programming anything?

    Any help is much appreciated ... thanks!

  • 06-10-2009 12:12 PM In reply to

    Re: How To Display File Name Inside Form?

    I'd add a field to the form data sourct to contain the file name. You can then use submit rules to populate that field with the same formula you use to generate the name, only populate the field if it is blank, and do that immediately before you submit....

    Hilary Stoupa

  • 06-10-2009 03:50 PM In reply to

    Re: How To Display File Name Inside Form?

    Yes, i would recommend that you actually create a filename field in the form, and you set this field's value upon initial submit (add as a rule).  You would then reference this field in your submit data connection so that it never gets recalculated and so that subsequent edits always overwrite the proper file.  You can of course display this filename field wherever you want in the form itself.

  • 06-14-2009 09:13 PM In reply to

    Re: How To Display File Name Inside Form?

    Thank you both for your input.

    I found an easier/simpler way.  Since Form Libraries store the "Title" by default for the form ... I did the following:

    1. Created a "filename" data source
    2. Made the Default Value: substring-before(@Title, ".")

    That is it.  The substring removes the ".xml" from the title and you are left with the just the file name without the extension.

    Cheers!

  • 06-14-2009 10:34 PM In reply to

    Re: How To Display File Name Inside Form?

    I would not recommend doing it that way, and I don't necessarily think it's easier than what I stated.  Here are my reasons:

    1. You're adding an unnecessary data connection (assuming that's what you mean by #1) that adds overhead to your template and increases wait time upon initial loading of the form
    2. You have to do a double-submit when it's first submitted in order to get that value into your form, because the title does not exist until it's first submitted.
    3. This supposedly allows users to define their own filenames, which is not a good practice due to the possibility of poor naming conventions, using the same name as another file, and/or putting spaces in names.  It's better to either auto-define a unique filename based off metadata in the form, or have the user type in a preferred filename within a field before submission so that you can dynamically create one using that info.  Either way, you'll have your filename set within the form before the initial submit, and the submit data connection will reference this filename every time it is submitted (initial and subsequent).  Of course, this means you have your filename handy as a piece of data within the form itself so that you can use it wherever.
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.