Formula expression to convert numeric to text
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I have built an app and a particular filed has almost always been text. However thru some testing, incoming data had some numeric values. Is there way using the formula tool to say something like.
if data is numeric then string? I tried placing select tool before the formula and is set to V-string, however my whole workflow blows up because this key field has some numeric values.
Thank you in advanced.
Solved! Go to Solution.
- Labels:
- Expression
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
HI @pvara
So first off, digits can be stored as either numeric or string values. In cases like this, I like using the Multi-Field Formula tool. Even if you use it on a single field, the cool feature is that you can apply a function AND change (read: force) the field type in one tool. So select the one or more fields, check the "update field type" options and use a formula like:
ToString([_CurrentField_])
So it always comes out a string type and value, and can be applied to as many fields as you would like.
EDIT:
Now, if you want to remove any digit characters, that's also possible using RegEx. You could update the previous formula with a RegEx_Replace( to look like this:
ToString(RegEx_Replace([_CurrentField_],"\d","")
Where any digit characters (referenced by "\d") are replaces with nothing (referenced by "").
