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

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

how to multipy by 100 a value of a line : tMap

Hello

I have 2 lines and several columns. All are in double in the fileinputExcel.

List1 Column A Column B Column C

Number 145,25 254,12 54,94

% 0,331 0,154 0,504

 

I only want to multiply the line with % by 100. So, in the fileOutputExcel, i want see :

List1 Column A Column B Column C

Number 145,25 254,12 54,94

% 33,1 15,4 50,4

 

I tried to use the component tMap but it multiply all the columns (Number and %).

 

I don't how to do

 

Thanks in advance

Labels (2)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

You may use a tJavaRow for this case:

 

output_row.List1 = input_row.List1;
if(input_row.List1.equals("%")) {
	output_row.ColA = input_row.ColA * 100;
	output_row.ColB = input_row.ColB * 100;
	output_row.ColC = input_row.ColC * 100;
}
else {
	output_row.ColA = input_row.ColA;
	output_row.ColB = input_row.ColB;
	output_row.ColC = input_row.ColC;
}

Using a tMap, you have to use the ternary notation:Capture.PNG

Hope this helps.

 

 

View solution in original post

2 Replies
TRF
Champion II
Champion II

You may use a tJavaRow for this case:

 

output_row.List1 = input_row.List1;
if(input_row.List1.equals("%")) {
	output_row.ColA = input_row.ColA * 100;
	output_row.ColB = input_row.ColB * 100;
	output_row.ColC = input_row.ColC * 100;
}
else {
	output_row.ColA = input_row.ColA;
	output_row.ColB = input_row.ColB;
	output_row.ColC = input_row.ColC;
}

Using a tMap, you have to use the ternary notation:Capture.PNG

Hope this helps.

 

 

Anonymous
Not applicable
Author

Thank you, it works well !