cancel
Showing results for 
Search instead for 
Did you mean: 

Pass a Comma for a blank value in CSV

Former Member
0 Kudos

Hi,

I need to post the data from a Proxy to the CSV file in UTF-8 format.

All the fields on target are mandatory and sometimes I may not have the values from the source. Then, a comma(,) has to be sent for that particular field in the target.

I tried doing with MapwithDefault with a Comma(,)

If the field value does not exist, then passed a Comma(,) from a constant.

Both of the above doesnt work and I get a blank in the target field.

When I used FIXVALUES for another field, I'v put a comma(,) in default. Then it works. But if it is without FIXVALUES, Fails.

Please help.

Regards,

Taro

Accepted Solutions (0)

Answers (3)

Answers (3)

0 Kudos

Hi Taro,

Do you can use Mapping with default in the fields. In this case when you pase the field empty always put the separator (,).

Best regards

Former Member
0 Kudos

Hi,

Thanks for the replies. I have done this using the st.functions in gr. mapping.

Now my doubt is, how do I check whether the generated file is in UTF-8 format or not?

Regards,

Taro

stefan_grube
Active Contributor
0 Kudos

you can check this with a hex editor.

But you need not check it, as the output file will be UTF-8 by default.

Former Member
0 Kudos

Hi Stefan,

The generated CSV is expected to be in UTF-8 for which I had specified the encoding to be UTF-8 in the file adapter. I just wanted to ensure.

Regards,

Taro

Former Member
0 Kudos

Hi Taro,

As Stefan said you need to use only fixvalues to achieve this requirement. Mapwithdefault function does not help you in this regard.

Thanks,

stefan_grube
Active Contributor
0 Kudos

Is comma the field seprarator? Then you should put anempty string, not an additional comma.

mapwithdefault works only with non-existing elements. Not for empty elements.

Edited by: Stefan Grube on Jan 20, 2011 4:37 PM

Former Member
0 Kudos

Hi Stefan,

Comma(,) is the separator and the condition is When no value is sent from the source, another comma should be displayed instead of the blank space in the file.

Changed the context and I'v put Comma(,) in MapwithDefault, checked the mapping. Still I see a blank.

regards,

Taro

stefan_grube
Active Contributor
0 Kudos

when you have fields A = x, B = empty , C = y, you want to see

- x,,y or

- x,,,y ?

Edited by: Stefan Grube on Jan 20, 2011 6:39 PM

Former Member
0 Kudos

The second one x,,,y

regards,

taro

stefan_grube
Active Contributor
0 Kudos

so you can do this with if or fixvalues, like you have already done.

mapwithdefault does not help.