Skip to Content

Sort different contexts (having multiple values), in ascending order, for the same queue.

Hello all,

I have a requirement where I need to sort one queue which contains multiple contexts and each context is having multiple values.

As per attached screenshot, I need to sort the output based on the value that is occurring before '+' symbol and publish the output in ascending order. My output should ideally look like follows:

15112371+98.83

15112371+0.43

.

.

.

15112371+

-Context Change-

15112372+98.84

15112372+0.50

.

.

.

15112372+

Looking forward to your kind inputs.

Best regards,

Aman

capture.jpg (56.2 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Jul 10, 2017 at 04:03 AM

    Hi Aman,

    Try following

    Do a remove context --> sort --> UDF with all values in queue.

    CODE:

    String s1="";
    String s2="";
    
    
    try{
    
    
    for(int i=0;i<input.length;i++)
    {
    		s1=input[i].substring(0,input[i].indexOf("+"));
    		s2=input[i+1].substring(0,input[i+1].indexOf("+"));
    
    
    	if (s1.equals(s2)) 
    		{
    						result.addValue(input[i]);
    		}
    		else
    		{
    						result.addValue(input[i]);
    						result.addValue(ResultList.CC);
    		}
    }
    
    
    
    
    }
    
    
    
    
    catch(Exception e)
    {
    
    
    }
    
    
    

    Thanks,

    Avinash B

    Add comment
    10|10000 characters needed characters exceeded