concat and substring question - InfoPath Dev
in

InfoPath Dev

concat and substring question

Last post 01-23-2012 10:49 PM by Jimmy. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 01-23-2012 08:28 AM

    concat and substring question

    I have several forms where I generate a ticket number. the form type is part of the ticket number. I want to get the first letter of each word from the form type, but I believe I may need some kind of an if statement. for example here are 4 types

    1. Primary
    2. Primary + Transportation
    3. Transportation
    4. Other

    what I need to return is

    1. P
    2. P+T
    3. T
    4. O

    there may also be some types with a hyphen.

    Is there a way to check for a specific character or count spaces and when greater than 1 I can do something like this:

    concat(substring(TitleCase, 1, 1), "+", substring(substring-after(TitleCase, "+"), 2, 1))

    and when no spaces I can do this:

    substring(TitleCase, 1, 1)

    Unless I am way off and there is a simpler way.

    Kind regards,
    Larry
    Filed under:
  • 01-23-2012 09:55 AM In reply to

    Re: concat and substring question

    How about this:

    concat(substring(TitleCase, 1, 1), substring(substring-after(TitleCase, ' '), 2, 1), substring(substring-after(TitleCase, "+"), 2, 1))

     

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 01-23-2012 12:05 PM In reply to

    Re: concat and substring question

    Thanks Jimmy, That was just about right, maybe was typo, the middle substring should be

    substring(substring-after(TitleCase, ' '), 1, 1)

    else it works perfectly.

    thanks

    Kind regards,
    Larry
  • 01-23-2012 10:49 PM In reply to

    Re: concat and substring question

    Ah, well spotted.  I didn't think it through completely.  Glad it worked otherwise!

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.