Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
//Assigning a value from incoming row;
String tempvalue = row23.data_value;
//The rest of the logic remains the same
//Initialize variables to hold the count
//Note:- if the count is anticipated to exceed the integer limit,
//then recommended to use long data type
int pol_count = 0;
int cust_count = 0;
//conditional statement to check the data_value
//the input row column is represented by input_row.column_name
if ( ("POLICY").equals(input_row.data_value) ) {
//the policy count is being held using pol_count variable.
pol_count++;
}
else {
if ( ("CUST").equals(input_row.data_value) ) {
cust_count++;
}
}
//The held counts can be printed using the sysout
System.out.println("Policy_Count : "+ pol_count + "\nCust_Count : "+ cust_count);