• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » [resolved] Checking for zero rows, how?

#1 2010-04-21 15:26:16

vitor_lopes
Member
Registered: 2009-08-05
Posts: 26

[resolved] Checking for zero rows, how?

Tags: [Runif, trigger, zero]

Hi,

I have the folowing scenario(image attached).


Can I use a "Run if" when the output is, like in the image, "0 rows"? If not, what is the best way to call another component when a result of a flow is zero rows?



Thanks,
Vitorr


Uploaded Images

Last edited by vitor_lopes (2010-04-21 16:18:12)

Offline

#2 2010-04-21 15:35:05

shong
Talend team
Registered: 2007-08-29
Posts: 10303
Website

Re: [resolved] Checking for zero rows, how?

Hello
Using the global variable: ((Integer)globalMap.get("tFileOutputExcel_1_NB_LINE")), for exmaple:
tFileInputDelimted---tFileOutputExcel_1
   |
onsubjobok
    |
tJava
    |
runIf---trigger other components.

on tJava:
int nb=((Integer)globalMap.get("tFileOutputExcel_1_NB_LINE"));
if(nb==0){
globalMap.put("key",true);
}else{
globalMap.put("key",false);
}

set the condition of runIf as:
(boolean)globalMap.get("key")


Best regards
Shong


Email:shong@talend.com
Choose Talend, Enjoy Talend!
New & Event: Talend Help Center
Talend-->the leader of open source data management and application integration solutions!

Offline

#3 2010-04-21 17:03:47

vitor_lopes
Member
Registered: 2009-08-05
Posts: 26

Re: [resolved] Checking for zero rows, how?

Hi Shong,

I have done it, however I keep on getting this error:
Error in the component's properties:Cannot cast from Object to boolean

Been trying to solve it but no success.



Thanks,
Vitor

Offline

#4 2010-04-22 05:46:03

shong
Talend team
Registered: 2007-08-29
Posts: 10303
Website

Re: [resolved] Checking for zero rows, how?

Hello
Sorry, the condition of RunIf should be:

Code:

(Boolean)globalMap.get("key")

Best regards
Shong


Email:shong@talend.com
Choose Talend, Enjoy Talend!
New & Event: Talend Help Center
Talend-->the leader of open source data management and application integration solutions!

Offline

#5 2010-04-22 11:38:46

vitor_lopes
Member
Registered: 2009-08-05
Posts: 26

Re: [resolved] Checking for zero rows, how?

Arrgh.. also missed that, that's what you get for programming in 3 different languages a day.

Many thanks,
Vitor Lopes

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » [resolved] Checking for zero rows, how?

Board footer

Powered by FluxBB