Get Current FileName - InfoPath Dev
in

InfoPath Dev

Get Current FileName

Last post 10-25-2010 10:35 AM by tkerkman. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 10-21-2010 02:55 PM

    Get Current FileName

    How do you get the current name of a file when opening a document to edit in info path. I want to get the name "FileName-1-2.xml" into a field on the form.

    When viewing the form through a web-browser I can seen the name of the file as the "Title" in on the HTML page. Furthermore, I can see the name of the file is stored in the "Name" field on the document library columns. 

    So how can I get that "Name" field into a field on the form when I open the form???

    This seems like it should be a simple task/function.

     

  • 10-21-2010 07:02 PM In reply to

     Hi, you can do that with some codes you can add an onLoad event and add this C# code:

    string caption = this.Application.ActiveWindow.Caption;
    this.MainDataSource.CreateNavigator().SelectSingleNode("XPATHNODE").SetValue(caption);

  • 10-25-2010 07:40 AM In reply to

    Or keep it simple by setting a 'filename' variable on form open to something like this :-

     concat(FirstName, "-", today(), "-", substring(now(), 12, 2), substring(now(), 15, 2))

     Will result in something like :- Jason-2010-10-25-1430

  • 10-25-2010 10:35 AM In reply to

    cheason,


    That actually what I ended up doing. (Creating a field and storing the name in the list).
    Seems odd to have to have to store the name of the file within the file itself, but it works.

Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.