on 02-19-2009 2:47 PM
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.