Tuesday, September 18, 2012

Substring in InfoPath

To get a value AFTER a character
substring-after(FieldName, ";")
This will return all text after the character ;


To get a value BEFORE a character
 substring-after(FieldName, ";")
This will return all text before the character ;


Substring and Concatenate

I often use Concatenate to join text from two fields. For example, the Date function now() has a "T" between Date and Time. I usually create a new field where I use substring and concatenate to replace the T with a space. Formula:

concat(substring-before(DateTimeField; "T"), " ",substring-after(DateTimeField; "T"))

This gives me the date and time in one single field with a space between.

 

2 comments:

Thomas said...

Lise, thanks for sharing this formula.

Lise Rasmussen said...

Hi Thomas,

You are welcome :)
/Lise