cancel
Showing results for 
Search instead for 
Did you mean: 

How to map empty IDoc field

Former Member
0 Kudos

Hi everybody!

I want to map the value of a source field through a <b>FixValues</b> function to the target field. Unfortunately this is an IDoc field which sometimes doesn't even exist (i. e. it's not just empty - it's not even there). In this case the <b>FixValues</b> function suppresses the output, and there is <i>no</i> output - not even the <i>default</i> value of <b>FixValues</b>. However, the requirement is that I always have to generate a default output - even if the input field is empty/missing.

Ony ideas how this could be done?

Regards, Joerg

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

where ever you required default values check if the condition exists pass map the source to target othere wise map the constant (what is the default that you assign in constant)...you need to use the If else condition to achive this.

Regards,

Venu.

former_member189558
Contributor
0 Kudos

Hi Joerg,

You have two options:

Under node function:

1) use the Exists functions , which will check the existance of that field and then use the if -then -else to populate the default ..

2) Or there is a "mapwithdefault" function available under the node function .. .

Either one will solve...

Cheers,

Himadri

Former Member
0 Kudos

Hi,

Thaks for the ideas.

Unfortunately this <i>doesn't</i> work for me - if the target field doesn't exist, either way the target is suppressed as well. This might have to do with the fact that I have several conditional <b>createIf</b>'s in the target hierarchy "above" the target field, i. e. the target field itself is created only conditionally - and maybe these different conditions get in each other's way...

I have notice, that the queue of my target field contains a SUPPRESS value (among others) - does this have something to do with my problem?

Regards, Joerg

former_member189558
Contributor
0 Kudos

Hello Joerg,

yes very much,

that case you can use a que function just before the target is mapped and in a loop populate the output que and populate the <default> whenever SUPPRESS occurs.

Cheers,

Himadri

Former Member
0 Kudos

Hi Himadri!

Thanks for the quick response! I tried to create such a que. However, it doesn't remove the SUPPRESS from the queue. Here's the code:


// Two input params: src[] and def[]
// src contains the input queue (with SUPPRESS values)
// dst contains (hopefully) only one value - the default value
int n=src.length;

result.clear();

if (n==0) {
  result.addValue(def[0]);
}
else {
  for (int i=0; i<n; i++) {
    if (src<i>.equals(ResultList.SUPPRESS)) {
      result.addValue(def[0]);
    }
    else {
      result.addValue(src<i>);
    }
  }
}

What am I doing wrong?

Regards, Joerg

former_member189558
Contributor
0 Kudos

Hi Joerg,

It is checking for two consequetive context changes :

Try this:

int n=src.length;

result.clear();

if (n==0) {

result.addValue(def[0]);

}

else {

for (int i=0; i<n; i++) {

if (src<i>.equals(ResultList.CC) && src[i+1].equals(ResultList.CC)) {

result.addValue(def[0]);

}

else {

result.addValue(src<i>);

}

}

}

former_member189558
Contributor
0 Kudos

Basicallu you need to modify ur if statetement from:

<i>if (src<i>.equals(ResultList.SUPPRESS))</i>

TO

<b>if (src<i>.equals(ResultList.CC) && src[i+1].equals(ResultList.CC))</b>

This will solve ur problem...

Please give points if useful

Cheers,

Himadri

null

Message was edited by:

Himadri Chakraborty