on 12-10-2009 3:19 PM
Hello experts,
I wrote an UDF to delete "false"-values from a queue:
String f = "false";
for(int i=0;i<list.length;i++)
{
if (list<i>.equals(f))
result.addSuppress();
else
result.addValue(list<i>);
}
I am adding a SUPPRESS for each "false"-value and I am not happy with that.
Question: Can I somehow delete the false-values from my queue?
Thank you for your help and best regards,
Peter
Why don't you go other way around.. I mean take the result only for true values, why to check for false values.
String t = "true";
for(int i=0;i<list.length;i++)
{
if (list<i>.equals(t))
result.addValue(list<i>);
}
Regards,
Sarvesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do u want to change false to soemthing else or you want to delete the value from context??
Option1:
You can use FixValues convertion function, If u don't want to lost the number of values in the context.
Key: false
Value : sUpPresSeD
Use input value if value is not provided
Option2:
You can use IfWithoutelse function with "Suppress" button Checked/unchecked.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Peter,
> Question: Can I somehow delete the false-values from my queue?
Yes you can.
Follow this code
> for(int i=0;i<list.length;i++)
> if (!(list<i>.equals("false")))
> result.addValue(list<i>);
Regards
Ramesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello experts,
Thank you so much for all your answers! I finally went with the solution from
Ramesh but the others would have worked as well.
I once read that performance-wise it is better to use negations just like in
for(int i=0;i<list.length;i++)
if (!(list.equals("false")))
result.addValue(list);
Thank you again!
Best regards,
Peter
Just a suggestion,
I am not very aware of your actual requirement, but if it is something like you want to create a node only if the input is true, then why not try a "create-if" node function.
Regards,
Ninu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
it's hard to answer without knowing your complete scenario, but maybe you don't need the suppress values.
Then you could write
String f = "false";
for(int i=0;i<list.length;i++)
{
if (!list<i>.equals(f))
result.addValue(list<i>);
}
Or maybe you could assure that you don't have false values in your queue.
Regards
Patrick
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
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.