Flat file adapter question

Hi, I need some help.
I have to write a flat file using convertToValues service.the field delimiter is | and the recored delimter is carriage return.I mean the Flat file will of the form something like
Now I need to do some thing.If the First field whose value is ‘a’ doesnt exist then i need to write the file as
How can i do that.I tried, when the field a doesnt exist exists it writes the file alwaz as |b|c but i need to write it as b|c.
Kindly help, thanks in advance

I have my own doubt if this is possible.

How does one know whether the contents is for field A or field B if the delimiter is omitted.

Guys around, any ideas if this is possible. correct me if i am wrong


Normally, when a field is empty the delimiter is still written. Consider another example:


If one writes the flat file as A|B|C||E then a consumer of the file readily knows that Field4 is empty. If the file is written A|B|C|E, then the consumer has no idea if E belongs in Field4 or Field5. Consider the case where multiple fields are null and parsing the record correctly is impossible.

Avinash, can you share a bit more of what the need is? With the info provided so far it would seem the solution you’re considering is heading down the wrong path.

hi avinash,
so one thing which can be done is ,
when u get the string output from the converToString (i hope u are writing to u a file).write extra functionality to see if the first char is A or | ,if its A do nothing , if its | delete or strip the first char and write the remaining substring.
so u can get the output to ur flat file as B|C.