Get Current FileName - InfoPath Dev Sign in | Join | Help in Newbie Questions InfoPath (Entire Site) InfoPath Dev InfoPath Dev is dedicated to bringing you the information and tools you need to be successful in your Microsoft Office InfoPath development projects. Home Blogs Forums Photos Downloads InfoPath Dev » InfoPath » Newbie Questions » Get Current FileName Get Current FileName Last post 10-25-2010 10:35 AM by tkerkman. 3 replies. Page 1 of 1 (4 items) Sort Posts: Oldest to newest Newest to oldest Previous Next 10-21-2010 02:55 PM tkerkman Joined on 12-29-2009 Posts 3 Get Current FileName Reply Contact 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. Filed under: INfopath 2003 get Current filename 10-21-2010 07:02 PM In reply to Potemkine Joined on 06-21-2010 Posts 451 Re: Get Current FileName Mark as Not AnswerMark as Answer... Reply Contact 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 cheason Joined on 09-28-2010 Posts 27 Re: Get Current FileName Mark as Not AnswerMark as Answer... Reply Contact 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 tkerkman Joined on 12-29-2009 Posts 3 Re: Get Current FileName Mark as Not AnswerMark as Answer... Reply Contact 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.
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.
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);
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
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.