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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

IF/else statement usage in tMap

How to compare and load data between two tables using talend, if I want to do the if/else to convert the kb/s to Mb/s how can I do that? After that, I have to take the higher value between the load_in & load_out column after the conversion. I'm very new to java & I need your help.

 

.-------+-------------+-------------+--------+--------+---------+---------.
| tLogRow_1 |
|=------+-------------+-------------+--------+--------+---------+--------=|
|site_id|load_in |load_out |loadin_A|loadin_B|loadout_A|loadout_B|
|=------+-------------+-------------+--------+--------+---------+--------=|
|8495A |3.13 Mb/s |22.82 Mb/s |3.13 |Mb/s |22.82 |Mb/s |

|8208B  |65.61  kb/s  |54.81  kb/s  |65.61   |kb/s    |54.81    |kb/s     |

Labels (3)
2 Replies
vapukov
Master II
Master II

You could do this in few steps

 

  1. If column contain Mb/s (check function INDEX)
    1. remove this text from column - ColumnName.replaceAll(" Mb/s", "")
    2. then convert value to double - Double.parseDouble(ColumnName)
  2. If column contain Kb/s
    1. remove this string - ColumnName.replaceAll(" kb/s", "")
    2. convert to double - Double.parseDouble(ColumnName)
    3. divide by 1024
  3. compare values - use ? construction - ColumnName1 > ColumnName2? ColumnName1:ColumnName2
Anonymous
Not applicable
Author

When I insert this into the T-Map at the load in column;

 

If column contain Mb/s (check function INDEX)

  1. remove this text from column - ColumnName.replaceAll(" Mb/s", "")
  2. then convert value to double - Double.parseDouble(ColumnName)

Exception in component tMap_4 (TMNGBH_MAXXX)
java.lang.NumberFormatException: empty String
at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
at sun.misc.FloatingDecimal.parseDouble(Unknown Source)
at java.lang.Double.parseDouble(Unknown Source)
at leasedline.tmngbh_maxxx_0_1.TMNGBH_MAXXX.tHashInput_1Process(TMNGBH_MAXXX.java:4490)
at leasedline.tmngbh_maxxx_0_1.TMNGBH_MAXXX.tFileInputExcel_1Process(TMNGBH_MAXXX.java:3428)
at leasedline.tmngbh_maxxx_0_1.TMNGBH_MAXXX.runJobInTOS(TMNGBH_MAXXX.java:6575)
at leasedline.tmngbh_maxxx_0_1.TMNGBH_MAXXX.main(TMNGBH_MAXXX.java:6424)

 

I get this one. How can I remove the empty string. I have tried with treplace but it still shows this error.