Substring attachment URL - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Substring attachment URL

Last post 04-22-2021 05:24 PM by Evanz. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 04-20-2021 02:22 PM

    • Evanz
    • Top 150 Contributor
    • Joined on 04-16-2020
    • Posts 78

    Substring attachment URL

    Hi, My InfoPath SharePoint list has a file attachment and I am able to display the attachment URL in a separate text field after a file attached. I wonder if there is a way to use a concat (substring-before(My URL), substring-after (My URL)) to get a file name of the attachment to be displayed in the text field, is it possible? Any suggestion is greatly appreciated!

     Thank you so much for your help!  

  • 04-20-2021 02:41 PM In reply to

    Re: Substring attachment URL

     I'm guessing this is related to your other post - what does the URL look like? This must be a SharePoint list form, right? So the URL will have the item's list ID prior to the name? What's a sample URL?

    Hilary Stoupa

  • 04-20-2021 04:35 PM In reply to

    • Evanz
    • Top 150 Contributor
    • Joined on 04-16-2020
    • Posts 78

    Re: Substring attachment URL

     Hi Hilary,

     Sorry, other post is slightly different because I realized that the InfoPath form for other post is using the Document Library, which somehow it does not appear the attachment URL as same as the list. Therefore, I was only able to display the attachment URL on the text field for the InfoPath SharePoint list, not the document library and I would like to use a substring for URL (Ex: https://eddnet/sites/TestSite/Lists/TestRequiredFields/Attachments/7/Test Doc5.docx) to get the only file name as Test Doc5.docx. is it possible? thanks so much for your help!



  • 04-20-2021 05:02 PM In reply to

    Re: Substring attachment URL

    I think you could use substring-after(substring-after(URL Field Here, "https://eddnet/sites/TestSite/Lists/TestRequiredFields/Attachments/"), "/")
    Hilary Stoupa

  • 04-20-2021 05:13 PM In reply to

    • Evanz
    • Top 150 Contributor
    • Joined on 04-16-2020
    • Posts 78

    Re: Substring attachment URL

     Thank you for your quick response. Let me try it out. Thanks, :)

     By the way, is it possible to get the same solution for the InfoPath document library as it does not appear the attachment URL like the list? How can I make it work? Any suggestion is greatly appreciated.  

  • 04-22-2021 10:38 AM In reply to

    • Evanz
    • Top 150 Contributor
    • Joined on 04-16-2020
    • Posts 78

    Re: Substring attachment URL

     Hi Hilary,

     I just tried to do in the following steps:

    Click on Text Box properties and click on "Fx" function > insert function: substring-after(substring-after("Link"), "/")


  • 04-22-2021 10:44 AM In reply to

    Re: Substring attachment URL

    Prior to "https" you need to select your field that has the attachment URL and add a comma. You'll see in my sample I had placeholder text for that.
    Hilary Stoupa

  • 04-22-2021 12:51 PM In reply to

    • Evanz
    • Top 150 Contributor
    • Joined on 04-16-2020
    • Posts 78

    Re: Substring attachment URL

    Thank you for your quick response, Hilary. The function works now without errors. However, when I use the function "Fx" for a text field, it only shows the file name of the attachment after submission. But I would like to the file name shows right away on the text field after a file attached, is it possible? if yes, how do I make it work? Any suggestion is greatly appreciated. Thanks again, :)

  • 04-22-2021 01:03 PM In reply to

    Re: Substring attachment URL

    This isn't possible, for the same reason as your other question, except in this case, code isn't an option because we can't add code to list forms. FormsViewer can do this - both for list and library forms, so if this is a feature you need, you may want to check it out. :)
    Hilary Stoupa

  • 04-22-2021 05:24 PM In reply to

    • Evanz
    • Top 150 Contributor
    • Joined on 04-16-2020
    • Posts 78

    Re: Substring attachment URL

    Thank you so much for your great suggestion, Hilary. I appreciated it. You're the best. :-)

    Have a great evening!

    Best Regards,  

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