Adding Spaces to string - InfoPath Dev
in

InfoPath Dev

Adding Spaces to string

Last post 08-15-2010 09:13 PM by Mirage. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 08-15-2010 06:41 PM

    • Mirage
    • Not Ranked
    • Joined on 08-15-2010
    • Posts 2

    Adding Spaces to string

    Hi all,

     My employer has recently sent me on a basic infopath course and I have been given the job of digitising all of our forms. The first one, probably the most difficult one, is a new client form.

    We are an accounting firm and the form will integrate with an excel database which then integrates with our CRM. I am slowly getting there however I am having issues with what we call a Tax File Number. It contains 8 or 9 numbers and needs to be in the format dd ddd ddd or ddd ddd ddd.

    I have used the following formula

    concat(substring(., 1, string-length(.) - 6), " ", substring(., string-length(.) - 5, 3), " ", substring(., string-length(.) - 2, 3))

    It throws the error of to many calculations. The first 2 or 3 digits work and the last 3 work but the middle 3 does something weird.

    123456789 -> 123 4 5 6 789. If I change the middle section to be 2 long instead of 3, it shows like it should however I get the to many calculations error again and of course the middle section is 1 number to short.

     Any help would be greatly appreciated as I have exhausted my ideas and cant find anything that really helps on any websites.

  • 08-15-2010 08:16 PM In reply to

    Re: Adding Spaces to string

    It sounds like you have the field recursively recalculating its own value over and over, which is what is causing that error and giving you that unexpected behavior.

    Are you using the formula in the field's Default Value, or a Rule?  I would suggest placing the formula in a rule, and giving it the condition to only execute if the string is 9 characters or less.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 08-15-2010 09:13 PM In reply to

    • Mirage
    • Not Ranked
    • Joined on 08-15-2010
    • Posts 2

    Re: Adding Spaces to string

    You are amazing. I had it in the default value. So I put it in as a rule to execute only if it was in the form \d\d\d\d\d\d\d\d or \d\d\d\d\d\d\d\d

    No doubt I will find something else over time particulary integrating it with our current database. Will report back with the final product or any additional questions.

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