Removing the first character of a text string if it exists. - InfoPath Dev
in

InfoPath Dev

Removing the first character of a text string if it exists.

Last post 01-06-2014 10:47 AM by fuzzbear. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 01-06-2014 08:02 AM

    Removing the first character of a text string if it exists.

    I have a form that users can fill out by either typing in by hand, or by using a barcode scanner attached to a computer. Unfortunately the bar-code contains an extra character we do not want. If a user scans our part number field, the scanner inputs "PXXXXXXXXX" If the user types in the number by hand they simply omit that P. SAP uses that first letter for something so I cannot have it removed from the label. The big problem is that our part numbers are alpanumeric and the Letter "P" could exist somewhere else in the field, so translate to a space wont work. I have tried substring-after, but it is blanking out the field no matter what I type. Anyone have any other suggestions? Ray
  • 01-06-2014 09:36 AM In reply to

    Re: Removing the first character of a text string if it exists.

     How about putting the following rule on the field in question:

    Condition: [field] starts with P

    Action: Set [field] to substring([field], 2)

    substring-after([field], "P") should be able to remove the P from the field, but without a condition to stop the rule's execution, it will run repeatedly until there's nothing left in the field.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 01-06-2014 10:47 AM In reply to

    Re: Removing the first character of a text string if it exists.

    Thank you so much, I didn't know that I could set a rule to just run like that! Thank you!
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.