regex help
- 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
how can I write a regex syntax to remove the "-" at the end and convert the number to a negative figure?
Currently the Amount Column is a V_String due to the hyphen at the end. I want to remove the hyphen then convert the cell to a double and make it a negative. I have been playing with the regex syntax to remove the hyphen but have had no luck. Thanks!
Solved! Go to Solution.
- Labels:
- Designer Cloud
- Regex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Can you just use replace function?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Another way - if you just want to remove it at the end, is to use a multi field formula tool with the following expression:
IF EndsWith(ToString([_CurrentField_]),”-“)
THEN ToNumber(LEFT(ToString([_CurrentField_]), LENGTH(ToString([_CurrentField_]))-1))
ELSE ToNumber([_CurrentField_])
ENDIF
Make sure to select the field of interest and turn off the Copy output fields and add function, and change the output type to Double.
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks! This worked!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you! This worked ....very slowly learning regex syntax.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks! Will try this out!
