on 08-05-2008 5:43 AM
I have to compare values within the same context.I am getting boolean values for that field.If all the values in the same context are true,then the result should be true .Otherwise false should be passed.
If input is-
<context>
true
false
true
<context>
true
true
<context>
Output should be as-
<context>
false
<context>
true
<context>
Please suggest how to acheive this?..its urgent
Hi Nagarjuna,
You can do it without going for UDF's.
Boolean function if without else can be used here. Pass values 'true' and 'false' to that function.
and use constant 'true' as a second argument of that function.
This will return 'true; for input value 'true'. else it will suppress the output.
Then just remove that suppression and you will get what you want.
Regards,
Shri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
use a udf of type context with parameter inputValue:
String returnValue = "true";
for (int index = 0; index < inputValue.length; index++) {
if (inputValue\[index\] == "false") {
returnValue = "false";
}
}
result.addValue(returnValue);
Regards
Patrick
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Check with this UDF
Src>UDF>target
public void context1(String[] a,ResultList result,Container container)
{
int k = 0;
int arrayLength = a.length;
if (arrayLength > 0)
{
String firstElement = a[0];
for (int i = 1; i < arrayLength; ++i)
{
if(!(a<i>.equalsIgnoreCase(firstElement)))
{
k = 0;
break;
}
else
k = 1;
}
}
if(k == 1)
result.addValue("true");
else
result.addValue("false");
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
1.Create a Context UDF.
2.Pass the source fields and use the following mapping.
Source field ---> UDF -
> collapseContext(node function) -
> Target filed
Use this code in the UDF
int flag=0;
for(int i=0;i<a.length;i++)
{
if (a<i>.equalsIgnoreCase("false") )
{
result.addValue("False");
flag = 1;
}
}
if (flag ==0) result.addValue("True");
Thanks
SaNv...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
set Context in UDF....
check value of false.. if it so put False.. else true
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.