2

I have a csv-file with fractional part of numbers delimited by comma:

header1;header2;header3;header4
text1;2,99;0,5;7,35
text2;6,12;3,98;0,15

How to create flat file XSD-schema from it? The problem is that flat file schema wizard expects dot as numbers' fractional part delimiter. Of course, I can create number fields as string fields and then create mapping for replace commas by dots. But this approach requires 1 additional schema and 1 orchestration with mapping. The problem is common and often appearing. Is there any way to replace commas by dots, when I create schema? Or any another way to solve this problem?

Vitaliy
  • 645
  • 1
  • 10
  • 21
  • 2
    Why not treat the the decimals as strings? Unless you are validating or having to do mathematics on it, then they will parse correctly. The other option would be to define your own type as per https://stackoverflow.com/questions/2237593/xml-schema-validation-different-separator-for-datatype-double – Dijkgraaf Sep 19 '17 at 22:56
  • It helps to do validation and avoid mapping. Thanks for good advise – Vitaliy Sep 20 '17 at 09:09

2 Answers2

4
  1. Create the fields as string by the wizard
  2. After creating the schema, change element's "Data Type" to decimal.
  3. Change the schema's Culture property to Turkish(Turkey) or any other culture that uses comma as decimal delimiter.

You don't need to use any map for the comma replacement

Serkan Arslan
  • 13,158
  • 4
  • 29
  • 44
2

I think there isn't a solution as you want, but you can use an Inbound Map on the same Receive Port and don't need the orchestration:

  1. Generate the Flat File Schema to get the equivalent XML with fields as Strings and decimals separated by comma.
  2. Generate the destination XML Schema, with the fields as decimal values.
  3. Generate the map, where you parse the input string fields with comma separated into the destination decimal fields.
  4. Configure your Pipeline on your Receive Location with the Flat File Disassembler and your Flat File Schema.
  5. Configure the Receive Port with the Inbound Map that you have generated.
Dijkgraaf
  • 11,049
  • 17
  • 42
  • 54
felixmondelo
  • 1,324
  • 1
  • 10
  • 19
  • Almost the same, but helps to avoid orchestration. Can you explain in more details step number 4? – Vitaliy Sep 19 '17 at 13:09
  • Yes, you need to create a Receive Pipeline with a Flat File Disaseembler. On this pipeline component, you have to set the Document Schema property with your Flat File Schema. This Receive Pipeline is what you need to use in your Receive Location. – felixmondelo Sep 19 '17 at 13:44
  • Ok, you mean Receive Pipeline, not Receive Location. Thanks for advice – Vitaliy Sep 19 '17 at 15:58