Skip to Content

Pass blank value based on the occurrence of a source field. SAP PI Graphical mapping.

Hi All,

I am in need of your help, I am having trouble configuring my graphical mapping.

I need to pass a blank value to the target field depending on the occurrence of an another source target.

For example, I have this 2 values that will be passed to the target field but it should have an another blank value because its dependence on the occurrence of an another source target which is 3. So basically it looks like this.

1 > 1

2 > 2

null > []

Could you help me with this? any help would be greatly appreciated. Thank you.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • May 18 at 05:33 AM

    Hi Nicolo Punzalan,

    You can write a UDF like below:

    public void Test(String[] input1, String[] input2, ResultList result, Container container) throws StreamTransformationException{
       for (int j=0; j<input1.length; j++){
    	result.addValue(input1[j]);
       }
       if (input2.length > 0){
          for (int i=0; i<input2.length; i++){
          if (!input2[i].equalsIgnoreCase(ResultList.SUPPRESS)||(!input2[i].equals("")))
        	 {
    	       result.addValue("");
         	}
           }	
        }
    }

    Where:

    • input1 is your first source
    • input2 is your 2nd source for which occurance needs to be checked
    • Note: after this udf, use std. function 'removeContext' then refer output to Target field

    I hope, above will help you.

    Thanks & Regards,

    Dilip

    Add comment
    10|10000 characters needed characters exceeded