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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Avoid special characters on tmap

Hi,

 

I have been trying to avoid the special character like 312328-342344 ("-") and have output as 312328342344 or even 312328 342344  but it is not happening. Can you please help me on this. I did try the following;

row2.ColumnName.replaceAll("[-]", "")  and more but it doesn't work, I keep getting error. This has a data type string by the way. Can somebody help on this?

Labels (2)
1 Solution

Accepted Solutions
vboppudi
Partner - Creator III
Partner - Creator III

try this

0683p000009LtZ3.png

Regards,

View solution in original post

20 Replies
Anonymous
Not applicable
Author

 Your code should work. What is the error? Is it a nullpointerexception? If so, use this code....

row2.ColumnName!=null ? row2.ColumnName.replaceAll("[-]", "") : row2.ColumnName
Anonymous
Not applicable
Author

Hi,

 

Thanks for the response, it is not null pointer error. I get below error;

Error Line: 3791

Detail Message: The operator || is undefined for the argument type(s) boolean, String

 

vboppudi
Partner - Creator III
Partner - Creator III

Hi,

 

Error is not with replace function. are you using any concatenation function in tMap? Please provide tMap configurations.

 

Regards,

Anonymous
Not applicable
Author

Hi Boppudi,

 

I am attaching the tmap expressions. Please let me know if any further questions.

 

 


tmapeg.JPG
vboppudi
Partner - Creator III
Partner - Creator III

I think it's syntax error. Can you please provide more details what you are doing in tMap. Why are you using || in coding?

 

Regards,

Anonymous
Not applicable
Author

Your expression is wrong. I suspect you are wanting to say....

 

"If AdminSystemValue is "CDB_AP" or

If AdminSystemValue is "CDB_CO" or

If AdminSystemValue is "CDB_CS" or.....etc

THEN replace all of the "-" chars in the AdminPartyId String"

 

In order to do that you need an inline IF. Something like this....

row2.AdminSystemValue!=null && (row2.AdminSystemValue.equals("CDB_AP") ||
row2.AdminSystemValue.equals("CDB_CO") || row2.AdminSystemValue.equals("CDB_CS")) ? row2.AdminPartyId.replaceAll("[-]","") : row2.AdminPartyId

I've given an example, not the complete code.

Anonymous
Not applicable
Author

Hi, as you see on screenshot other are the filters to get the data I like to have in output. Suppose

row2.AdminSystemValue.equals("CR") pulls CR data and || is or character to add more filters. Above

row2.AdminPartyId.replaceAll("[-]", "") is working and I get out as expected. When I put

row2.AdminPartyId.replaceAll("[-]", "") then get that error shared.

vboppudi
Partner - Creator III
Partner - Creator III

This is because row2.AdminSystemValue.equals("CR") gives you TRUE OR FALSE, but row2.AdminPartyId.replaceAll("[-]", "") will give you return value after replace. As per my knowledge you can not use different boolean and string value functions in the same function. 

 

Regards,

Anonymous
Not applicable
Author

You can use an inline IF as I have demonstrated above