Skip to Content

UDF to produce output queue without false

Hi Experts,

Output queue should be produced after removing "false" values and it should not contain either "SUPPRESS" or "<null>" values in the place of false.

I can achieve requirement by using "ifWithoutelse" but it will produce SUPPRESS values wherever the false value appears, I do not require that.

Also if I write below UDF it will return <null> values in queue.

for(int i=0;i<Input.length;i++)

{

if(!(Input[i].equals("false))) { result.addValue(Input[i]);

} }

Input Queue:

Output Queue should look exactly like below:

Is it possible to achieve the requirement?

Thanks,

Ramu.

inputq.jpg (23.0 kB)
outputq.jpg (19.6 kB)
Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 09, 2017 at 06:29 PM

    Because you are not handling context changes once we have false values its not resulting into expected output queue.

    Assumption : all values in a context can either all be true or all be false and NOT mix of both. (base on your input queue screenshot)

    Use below code:

    import all values form source field in var1[] (all values of queue)

    //pull all values in the queue and loop all over the values
    for(int i =0; i<var1.length; i++)
    {
    	//compare each value to "true"
    	if ((var1[i].equals("true"))){
    		//add values to result queue only if value is true
    		result.addValue(var1[i]);
    		}
    	//else check if it context change, if yes
    	else if(var1[i].equals(ResultList.CC)){
    		//check if previous value before context change is true, if yes
    		if(var1[i-1].equals("true")){
    			//add context change to result queue
    			result.addContextChange();
    			}
    			//else do nothing
    			
    		}
    	
    }
    
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 12, 2017 at 11:45 AM

    Hi Ramu!

    IfWithoutElse function has a parameter named "Keep SUPPRESS values". If you turn it off, you won't get that values in output queue.

    Regards, Evgeniy.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 13, 2017 at 04:53 AM

    Hi Ramu,

    Hope this works even when we have mix of values.

    String lastone="";
    for(int i=0;i<Input.length;i++)
    {
    if(Input[i].equalsIgnoreCase("True"))
    	{ 
    	lastone=Input[i];
    	result.addValue(Input[i]);
    	}
    else if((Input[i].equals(ResultList.CC)))
    	{
    	if(lastone.equalsIgnoreCase("True"))
    	{
    	lastone="";
    	result.addContextChange();
    	}
    }
    }
    
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.