Auto Dash for field - InfoPath Dev
in

InfoPath Dev

Auto Dash for field

Last post 05-16-2011 08:30 AM by tafavorite. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 05-13-2011 10:54 AM

    Auto Dash for field

    Hello,

    I have a request that the owner would like their form to have a field be able to put the dash into this so the user does not have to. What the user has to enter is the following:

    AA-1111

    So the user should only enter: AA1111 and then a rule should be able to put the dash in the correct spot. I'm not sure how to do that exactly thou. Anyone have a clear method on how to accomplish this. Thanks.

  • 05-15-2011 03:41 PM In reply to

    • Skarn
    • Top 50 Contributor
      Male
    • Joined on 04-20-2008
    • Australia
    • Posts 198

     As a rule on the field - setting it's value.

     Formula:

     concat(substring(translate(., "-", ""), 1, 2), "-", substring(translate(., "-", ""), 3))

    ================================================================
    This formula contains embedded commands:

    A = translate(., "-", "")

    to remove all existing dashes before processing the current field value.

    B = substring(A ,1 ,2)
    C = substring(A, 3)

    to separate the first two characters and the rest of the current field value into two components.

    concat(B,"-",C)

    to combine the separated parts together with a dash in between.

     

     


  • 05-16-2011 08:30 AM In reply to

    Thank you for your help. This did exactly what I needed. Been of great help, thanks again.

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