Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello friends, help me please.
1- I have a tmap and in this component I make a filter.
filter:
2- I would like to store the amount of "D" or "N" generated by this filter to be used in a context.
Sorry for my english
Hi,
One of the easiest way is to use a tjavarow after tMap to do the count. Please note that this is one among many solutions you can create for this scenario. The steps are as below.
a) Create two context variables called D_count and N_count and assign the initial values as zero.
b) Connect a tjavarow after tMap and assign all the output columns as pass through fields from input columns. You can use automapping functionality in tjavarow since your schema remains same
eg:- output_row.filler=input_row.filler
c) Add a if condition at the end of mapping in javarow to check the value of FLAG_VENDA. The pseudo code is as shown below.
if (FLAG_VENDA.equals("D))
{
context.D_count=context.D_count+1;
}
You need to add the condition for both values (D and N) and you will get the counts to context variables for later use 🙂 Please make sure that you are not having any null values to this field as equals() function will throw error.
If the answer has helped you, could you please mark the topic as resolved? Kudos are also welcome 🙂
Warm Regards,
Nikhil Thampi
Hi,
One of the easiest way is to use a tjavarow after tMap to do the count. Please note that this is one among many solutions you can create for this scenario. The steps are as below.
a) Create two context variables called D_count and N_count and assign the initial values as zero.
b) Connect a tjavarow after tMap and assign all the output columns as pass through fields from input columns. You can use automapping functionality in tjavarow since your schema remains same
eg:- output_row.filler=input_row.filler
c) Add a if condition at the end of mapping in javarow to check the value of FLAG_VENDA. The pseudo code is as shown below.
if (FLAG_VENDA.equals("D))
{
context.D_count=context.D_count+1;
}
You need to add the condition for both values (D and N) and you will get the counts to context variables for later use 🙂 Please make sure that you are not having any null values to this field as equals() function will throw error.
If the answer has helped you, could you please mark the topic as resolved? Kudos are also welcome 🙂
Warm Regards,
Nikhil Thampi
Hi Nikhil,
I have similar query to count the ID from the source file and seperate them in to 2 different columns as Single & Multiple Entry becoz ID will be unique for multiple entries & some ID do not have multiple entries. I want to get the count details based on the Numbers and segrate that value in seperate column.
Is it feasible ?
Angel