cancel
Showing results for 
Search instead for 
Did you mean: 

How to send default (spaces) if there is no value using File Adaptor

Former Member
0 Kudos

Hi guys,

I am working on IDOC to File scenario where I need to pass empty value for each field we map.. I see in IDOC there are no segments at all and for such I am unable to send any value to the file..

Eg: Field1,Field2,Field3

I am getting in File as : A|B

A if there are no values for B and C

But it should be A| | If there are no values for B and C.

How could I make it?

Thanks

Rajeev

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Rajeev,

For all the fields in your mapping, use mapwithdefault funciton. Double click on the function and put space there. So if the field is present field value will be populated, if the field is not present then mapwithdefault which is space will be populated inthe file.

source field --> your logic --> mapwithdefault(space) --> target.

Regards,

---Satish

Former Member
0 Kudos

Hi Satish,

I trid wtih Mapwithdefaultvalue but its not working out, which I am testing in MM test tad

Field(empty)-->MAPWITHDEFAULTVALUE (ABC)---->TargetField

I am not getting ABC in the target field

Thanks

RAJEEV

Former Member
0 Kudos

Hi Rajeev,

Does the segment for target field is populating? If the segment is populated then at field level if you use mapwithdefault it should work. If the segment is not populated then as suggested by juan you need to use if else. First make sure you have segment and then the field.

Regards,

---Satish

Former Member
0 Kudos

Hi,

I am using what Juan said if else constant approach by checking wheather this filed exist by mapbydefaultvalue

I am working on one condition:

If Filed1 =Y or Field2=Y or Field3=1 or Fiedl4=1 then target field = A

or if all of the 4 fields are satisfied then B

I wrote a java UDF but I am getting <null> and [/] in the context queue. Ofcourse fields are with / and some fields doenst exist.. in this case how can I handle ?

THanks

Rajeev.

Answers (3)

Answers (3)

former_member182004
Contributor
0 Kudos

Hi Rajeev,

You don't need to write a UDF, in that case in which the field.. could come empty.. or even couldn't come, you have to ask for, if the field EXISTS, and if exists... if it's EQUALS to '' (empty field)

Try that to validate both conditions,

Regards,

Juan

Former Member
0 Kudos

Hi All,

Its solved.. Thanks Satish and Juan.

I used MAPWITHDEFAULT function before each filed and passed to UDF(Checks is it equals to).

Thanks alot and points are awarded.

Rajeev

former_member182004
Contributor
0 Kudos

Rajeev,

What Satish told you, works if the node, or segment, doesn't exist. NOT if this is blank because there aren't any value.

If you want to populate them when they are blank, you have to do an IF as I told you, asking if it's equals to '' (nothing). That value is different than a non-existence node.

Regards,

Juan

former_member182004
Contributor
0 Kudos

Hi Rajeev,

You can achieve this by using standard mapping functions such as:

if Node (or segment) exists

[you pass the value of that node]

else

[you can pass a constant space ' ']

In here you'd have to use, the function IF, EXISTS, and CONSTANT.

Try it,

Regards,

Juan