on 04-10-2008 8:42 AM
Hi,
Queue values :
contextchange
False
contextchange
True
False
False
False
contextchange
False
True
False
False
False
contextchange
False
False
True
False
False
Each context can have either one True value or no true values
I want to suppress all False values in the same context.
If I have true, I should keep true. If there is not even one true value, then place a false value
how do I do it?
thanks and regards,
Nikhil.
Hi,
Create a user defined function like below, I think it will solve your problem.
Function: TrueFalse, Values = Context
Variables: input (String), result (ResultList)
Code:
int includesTrue = 0;
for(int i = 0; i < input.length; i++)
{
if(input.equals("True"))
{
includesTrue = 1;
}
}
if(includesTrue == 0)
result.addValue("False");
else
result.addValue("True");
Regards,
Gökhan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
this is adding a value SUPRESS to the code, I want to delete the false values and the context shud have either true or false
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Input Queue:
contextchange
False
contextchange
True
False
False
False
contextchange
False
True
False
False
False
contextchange
False
False
True
False
False
Output Queue:
contextchange
SUPPRESS
contextchange
True
SUPPRESS
SUPPRESS
SUPPRESS
contextchange
SUPPRESS
True
SUPPRESS
SUPPRESS
SUPPRESS
contextchange
SUPPRESS
SUPPRESS
True
SUPPRESS
SUPPRESS
now dont want these SUPPRESS values also
i need either true or false
following is the UDF i wrote using QUEUE
*boolean hasTrue = false;
for(int i = 0; i < input.length; i++)
{
if(input<i>.equals("false")) //suppress the false value
{
result.addValue(result.SUPPRESS);
}
else if(input<i>.equals("true")) //add true to output
{
hasTrue = true;
result.addValue(input<i>);
}
}
if(!hasTrue)
{
result.clear();
result.addValue("False");
}*
try this 😛
Function: TrueFalse, Values = Context
Variables: input (String), result (ResultList)
code:
boolean hasTrue = false;
for(int i = 0; i < input.length; i++)
{
if(input<i>.equals("False")) //suppress the false value
{
result.addValue(ResultList.SUPPRESS);
}
else if(input<i>.equals("True")) //add true to output
{
hasTrue = true;
result.addValue(input<i>);
}
}
if(!hasTrue)
{
result.clear();
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,
Explain with one simple example.
chirag
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.