Convert string to URL? - InfoPath Dev
in

InfoPath Dev

Convert string to URL?

Last post 03-11-2013 12:37 PM by smonczka. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 03-06-2013 10:34 AM

    Convert string to URL?

    How can I convert a string such as "https://portal.com/test text.doc" to "https://portal.com/test%20text.doc".  

    I am pulling in SharePoint list field that has a URL in it.  I am then placing that information a HyperLink control on the form. 

    When I test the link in the client (InfoPath) the link opens up as https://portal.com/test%20text.doc

    But when I open up the form in SharePoint (as a browser based form) it opens the link as https://portal.com/test text.doc and can not find the document.

    I have tried using the Translate Function to add the "%20" to the string this pull the field in as text and the link in the form will not work.  I have also tried concat the string by adding " " around the url but this caused problems with " example... concat(" " ",translate(url, " ", "%20")," " ").  I was hoping this would return... "https://portal.com/test%20text.doc"

    Any ideas would be appreciated

    Thanks 

     

  • 03-09-2013 01:11 PM In reply to

    Well, first off, you could disable save and use a submit button instead and force the name to not have spaces... :)

    If you can't use translate, how about substring and concat? Something like: concat(substring-before(../my:field1, " "), "%20", substring-after(../my:field1, " "))

    To do multiple spaces, you'll have to use eval(eval(...)) trick to get it to concatenate. Might take 20 minutes to figure out the expression... but DOABLE.

    Once again, though, you're better off just not letting them add spaces or special characters. Just translate those into nothing and force the save by submitting via a custom button in the form and disabling the file-save and file-saveas buttons.

    Patrick Halstead
    Project Manager at Qdabra
  • 03-11-2013 12:37 PM In reply to

    Patrick  thanks for the responce.  From what I have been able to tell this is a regular problem for people trying create dynamic links to SharePoint documents.  For the moment I have asked the users not to use spaces in thier file names while I work out a fix.  As you have stated doing this in InfoPath with Translate and Concat is a time suck. I'm going to try another tactic and see if I can create a workflow that might acomplish the same thing.

    Thanks again for your responce. 

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