Rank: Newbie
Groups: Registered
Joined: 9/8/2017(UTC) Posts: 8  Location: MA Thanks: 2 times
|
To All, Could you provide a working example of the 'string-format()' function found in the Expression Builder? I can't seem to get it to work properly. I am trying display a properly formatted telephone number (i.e. '(555) 555-1111') after user simply enters the number data in an 'edit field'. Thank you in advance...
|
|
|
|
Rank: Administration
Groups: Registered, Administrators Joined: 9/15/2014(UTC) Posts: 133  Was thanked: 18 time(s) in 18 post(s)
|
Hello Mark! The XPath/XQuery standard does not specify number format strings as you would need here (also see XPath number formatting picture string). So we would suggest to use regex replace, e.g. Quote:replace( "5555551111", "^(\d{3})(\d{3})(\d+)$", "($1) $2-$3" ) will return Attached is also a small sample which allows to enter numbers in an Edit Field and shows the formatted telephone number in a Label. Does this help? Best regards, AFC
|
 1 user thanked AFC for this useful post.
|
|
|
Rank: Newbie
Groups: Registered
Joined: 9/8/2017(UTC) Posts: 8  Location: MA Thanks: 2 times
|
AFC, Thank you again, I was able to accomplish this with a combination of stringsub and concat functions, but your way is a little more elegant. Mark Originally Posted by: AFC  Hello Mark! The XPath/XQuery standard does not specify number format strings as you would need here (also see XPath number formatting picture string). So we would suggest to use regex replace, e.g. Quote:replace( "5555551111", "^(\d{3})(\d{3})(\d+)$", "($1) $2-$3" ) will return Attached is also a small sample which allows to enter numbers in an Edit Field and shows the formatted telephone number in a Label. Does this help? Best regards, AFC
|
|
|
|
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.