cancel
Showing results for 
Search instead for 
Did you mean: 

Remove surpress

former_member452321
Participant
0 Kudos

Hi

I need some help in remove surpress for the field Tel number. I am getting the result from if else condition output as per the screen shot attached I tried to use the following code but getting nullpointer exception

Argument -Input String[]

result Resultlist

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

     {

          if(!(Input[i].equals(ResultList.SUPPRESS)))

          {

               result.addValue(Input[i]);

          }

Accepted Solutions (0)

Answers (3)

Answers (3)

Harish
Active Contributor
0 Kudos

Hi Mahesh,

Please modify your code as below

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

     {

          if(!(Input[i].equals(ResultList.SUPPRESS)))

          {

               result.addValue(Input[i]);

          }

Regards,

Harish

Former Member
0 Kudos

Hi Mahesh,

it is no surprise that you get a NullPointerException, since SUPPRESS is actually a synonyme for "null". So when you try to assign the value to the result list, you try to access an element that is in fact null. Hence the exception.

As Adarsh said, a RemoveContext would solve that issue in this case. If you could get multiple TelNr here, you might get into trouble with RemoveContext. That depends on the input data you get and the result you need to deliver.

Regards,

Jörg

former_member184789
Active Contributor
0 Kudos

Hi,

For the above requirement, you don't need a code. Simply have a remove contexts as it will have the same functionality for your case.BTW the code is fine, you just need to provide one closing bracket i.e } at the end. See it working here: