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: 
agentgill
Contributor
Contributor

Type mismatch: cannot convert from Object...to String in tMap

Hi,
This is driving me crazy - pretty sure it's my knowledge of Java
(name value pair context file)
row1.Column0 is String
row1.Column1 is String
When (0) is LastBatchId, position (1) is treated as int which we want to increment plus 1
row1.Column0.equals("LastBatchId")
? Integer.parseInt(row1.Column1)+1 : "0"
Testing in the expression builder works, but executing and expression warning output is throwing this error
Type mismatch: cannot convert from Object...to String.
I am output all pairs to as strings. See screen shot for better idea.
Any help welcome
0683p000009MEf0.jpg
Labels (3)
3 Replies
Anonymous
Not applicable

The problem is a bit misleading error message. The true-part of your ? operator returns an int and this cannot be cast to a String. Try this:
row1.Column0.equals("LastBatchId") ? String.valueOf(Integer.parseInt(row1.Column1)+1) : "0"
In this version the int values will be converted into a String and this can be used.
agentgill
Contributor
Contributor
Author

Thanks, that makes sense and works!
_AnonymousUser
Specialist III
Specialist III

Hi,
This is driving me crazy - pretty sure it's my knowledge of Java
(name value pair context file)
row1.Column0 is String
row1.Column1 is String
When (0) is LastBatchId, position (1) is treated as int which we want to increment plus 1
row1.Column0.equals("LastBatchId")
? Integer.parseInt(row1.Column1)+1 : "0"  
Testing in the expression builder works, but executing and expression warning output is throwing this error
Type mismatch: cannot convert from Object...to String.
I am output all pairs to as strings. See screen shot for better idea.
Any help welcome

type Mismatch error: How to convert object type into int