How to apply trim() function for values in drop down? - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

How to apply trim() function for values in drop down?

Last post 06-07-2012 10:20 AM by Jimmy. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 03-15-2011 05:05 AM

    How to apply trim() function for values in drop down?

    Hi Folks, I had drop down in Infopath which fetch values from Sharepoint List column. Values are coming correctly, but prefix with some junk data. e.g. "20#;CorrectValue1". "20#;" are junk values While research, I got to know that Sharepoint List column is lookup and it is referencing another Sharepoint List column. And junk value are row number in reference List. I mean - "20#;" is the 20th row for 'CorrectValue1' in reference List. Is there any Trim function to trim junk values. If yes, please let me know how to achieve this. Please advice. - Chintan
    Thanks,
    Chintan
  • 03-15-2011 05:52 AM In reply to

    Re: How to apply trim() function for values in drop down?

     there is no out of box feature to do so, you will have to do it through code

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 03-16-2011 11:17 AM In reply to

    Re: How to apply trim() function for values in drop down?

    Hi Chintan, yes, you can use the function substring-after(@field, "#;"). It will return contents of the string after the first occurence of "#;".
  • 06-07-2012 06:05 AM In reply to

    Re: How to apply trim() function for values in drop down?

    Hi qwerty, I tried it, trimming only apply to first item and not all items in dropdown. I wrote rules when form loads. Pls. advice further.
    Thanks,
    Chintan
  • 06-07-2012 08:04 AM In reply to

    Re: How to apply trim() function for values in drop down?

    Are there any other fields in that data source that you're not using?  If so, please try the following:

    Add a rule to set the value of the extra field to a value it wouldn't normally have (like "go") after the data is queried (probably a Form Load rule).

    Add a rule to that extra field itself like the following:
       Condition: FieldToFix contains #;
      
    Action: Set FieldToFix = substring-after(FieldToFix, '#;')

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 06-07-2012 10:00 AM In reply to

    Re: How to apply trim() function for values in drop down?

    Thx Jimmy for your reply. I did it but triming only applies to 1st item in drop down :(
    Thanks,
    Chintan
  • 06-07-2012 10:20 AM In reply to

    Re: How to apply trim() function for values in drop down?

    Would you be able to attach your form to this thread so that we can see it?
    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.