cancel
Showing results for 
Search instead for 
Did you mean: 

query on context change

Former Member
0 Kudos

Hi,

i am getting small problem in the context change..

i have input as

1

2

3

[3]context change

4

5

[5]conext change

6

7

8

[8]context change

i want out put as

2

3

[3]conext change

5

[5]context change

7

8

[8]context change

my requirement is the element after context change in the input sholud be deleted.

Thank you,

Madhav.

Accepted Solutions (1)

Accepted Solutions (1)

sunil_singh13
Active Contributor
0 Kudos

Hi Madhav,

You have to write UDF for this.

In that check for

ResultList.CC (it will check if there is any context change) if true then increment the counter else add result.addValue(Value).

Thanks

Sunil Singh

Former Member
0 Kudos

hi,

i have changed it to ResultList.CC , even it is giving the same out put as prevoiusly, it is executing only else part only.

Thank you,

Madhav

Former Member
0 Kudos

a.equals hona chahiye ya a [ i ] .equals?

Regards

sunil_singh13
Active Contributor
0 Kudos

Hi Madhav,

Try This

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

{

if(a<i>.equals(ResultList.CC))

{

result.addValue(ResultList.CC);

i++ ;

}

else

result.addValue(a<i>);

}

"if(a.equals(ResultList.CC))" it should be a(i) but in rect bracket ,Dont know why it is not showing the same in above code

Thanks

Sunil Singh

Edited by: SUNIL SINGH on Nov 19, 2008 5:57 AM

Edited by: SUNIL SINGH on Nov 19, 2008 5:59 AM

santhosh_kumarv
Active Contributor
0 Kudos

Hi,

By any chance did you tried the UDF that I replied earlier..

It is simple logic to always ignore the 0th array i.e. the first element of all the queue...

Thanks

SaNv...

SudhirT
Active Contributor
0 Kudos

Hi,

Try this code

for(int i=0;i<a.length;i++)
{
if(a<i>.equals(ResultList.CC))
{
result.addValue(ResultList.CC);
i++ ;
}
else
result.addValue(a[i++]);
}

SUNIL, The Reply section contains some functionality on top of the pad like Bold characters,Italic characters, sidewise you will find an icon with tool tip (click to display as java code), you just need to select the code you written and click on the icon, that will always disply your code exactly as you wrote.

Thanks!

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks SANV

Former Member
0 Kudos

Hello

You could write a user-defined function to do so!

Regards

Former Member
0 Kudos

hi,

i have written a UDF, but it is not working proprly, it is not identifying the context change

this is the UDF i have written,

//write your code here

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

{

if(a<i>.equals(result.CC))

{

result.addValue(a[i+1]);

}

else

result.addValue(a[i++]);

}

in the above UDF the it is giving out put from the else part only...

it will gr8 help if any one can correct my UDF.

Thank you,

Madhav.

santhosh_kumarv
Active Contributor
0 Kudos

Hi,

Create a Context UDF with the following code..

public void con(String[] a,ResultList result,Container container)
{
for(int i=1;i<a.length;i++)
result.addValue(a<i>);
}

source -


> con -


> target.

This will solve your requirement.

Thanks

SaNv...

Former Member
0 Kudos

Hello

ResultList.CC use kijiye, in place of result.CC!

Regards

Former Member
0 Kudos

Hi,

Along with changing result.CC to ResultList.CC, you will need to change the following:

else
   result.addValue(a[i++]);

to:

else
  result.addValue(a<i>);

The value of i is getting incremented in the for loop. It is not needed in the else part.

Best Regards,

Alka.