cancel
Showing results for 
Search instead for 
Did you mean: 

Delete "false"-values from queue?

peter_wallner2
Active Contributor
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Answers (4)

Answers (4)

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

peter_wallner2
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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