cancel
Showing results for 
Search instead for 
Did you mean: 

Queue Problem

Former Member
0 Kudos

Hi All,

I need to check all values of a field in its queue of message mapping. If all values are same in queue,i need to return true else return false.

Please advise how to achieve this.

Thanks,

Marz

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Try the below UDF.It return true to the target field iff all the values in the queue are same, else false.

source-> UDF->target

UDF: cache: Queue, SourceField : sInput

int j = sInput.length-1;

int i=0;

int k=0;

while(i<=j)

{

if(sInput<i>.equals(sInput[j]))

{ i++;

k = i+1;}

else

{

break;

}

}

if(sInput[k].equals(sInput[j]))

{

result.addValue("true");

}

else

result.addValue("false");

Regards,

Swetha.

0 Kudos

Hi,

Why you need UDF's,

First use the SORT from the nodefuntions and then use SPLITBY VALUEC HANGE function, If you get more than one value in the output of SPLIT BY VALUE CHANGE, then the values in the field are not same.

You can return the false after that.

Regards,

Krishnaraju.

Edited by: v r krishnaraju mudunuri on Feb 20, 2009 1:12 AM

Former Member
0 Kudos

Hi,

You can do this by using simple User defined function as below.

Say like: functin named as compare

for(int i=0;i<n;i++)

{

int m,n;

a<i> = m;

a[1+1] = n;

if(m==n)

{

return(true);

}

else return(false);

}

Now in graphical mapping

You can assign this user define function to the target value

Source field ---> Compare Funtion --> Target Function.

Check this out..

Rgds,

sweety

Edited by: sweety on Feb 19, 2009 4:25 PM