Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
ptremblay
Contributor
Contributor

Problem replacing (getting rid of) the dollar sign in an input string.

Bonjour,
I have an input data file that looks like this:
Amount Date Type Memo Payee Name
$3,044.18 6/11/2009 12:00:00 PM CREDIT IDSL Dépôt au comptoir/CP SAINT-ANDRE
-$100.00 6/11/2009 12:00:00 PM DEBIT IRSL Retrait au comptoir/CP SAINT-AND
The problem I have is that I want to get rid of the "$" in the Amount column which I process as a string.
Note: I put "+++" to illustrate what happens to the $ after the output. In reality I want to get rid of the $ so I have either a negative or a positive number.
In my tMap component I put the following expression:
StringHandling.CHANGE(row1.Amount,"$","+++")
Here's the output for after processing that column:
$3,044.18+++
-$100.00+++
I also tried: StringHandling.EREPLACE(row1.Amount,"$","+++") and got the exact same output.
I understand that $ in a regular expression means the last character of the string but in these StringHangling functions (CHANGE and EREPLACE) I would expect the output to be:
+++3,044.18
-+++100.00
Is there I else I should do with the CHANGE function?
Thanks.
PM
Labels (2)
1 Reply
Anonymous
Not applicable

Hello guy
try
row1.name.replaceAll("\\$","")

Best regards
shong