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

Division operation string values using tmap

Hi Team,

 

I have two columns which values contains 0(ZERO) both columns are string.

 

Expression: col1/col2

datatype should be float or decimal and load into redshift table(numeric data type)

 

Note: col1 and col2 either or both contains 0 values col1 and col2.

 

How to achieve above scenario.

 

Thanks

shree

 

Labels (2)
4 Replies
fdenis
Master
Master

(col2!=0)?col1/col2:0
TRF
Champion II
Champion II

You need to use equals method to compare string variables, then you can use Float.parseFloat to convert both strings to Float before the division:

 

(row1.col2.equals("0")) ? 0 : Float.parseFloat(row1.col1) / Float.parseFloat(row1.col2)
TRF
Champion II
Champion II

@bshree88did this help you? If so, thank's to mark you case as Solved (Kudos also accepted)