locked
Positional flat file, remove empty/blank lines from result RRS feed

  • Question

  • Hi!

    I have a xml file that needs to be converted to positional flat file. I have successfully created mappings&schema and i can convert xml to flat file. But now my problem is empty/blank lines on result. Like this:

    id name address
    id name address

    id name address
    id name address

    I googled and tested to use custom xslt to remove empty nodes from xml with extra mapping and it worked on xml but not with flat file result (https://talentedmonkeys.wordpress.com/2010/06/03/removing-empty-nodes-from-a-message-using-xslt-and-the-biztalk-mapper/).

    Is there another/easy way to remove empty/blank lines from resulted flat files? 

    Tuesday, December 29, 2015 4:13 PM

Answers

  • If you are creating the flat file, the problem is that otherwise empty record elements are being crated in the Xml version, either in the previous Map or from the source.

    Most likely, the solution to this problem is in the Map.  You must suppress reason empty Records are created.

    • Marked as answer by Teammala Tuesday, December 29, 2015 8:46 PM
    Tuesday, December 29, 2015 6:52 PM
    Moderator

All replies

  • Hi,

    Thank you for posting in MSDN forum.

    I can see four solutions depending the exact issue:

    1. Set "suppress_trailing_delimiters" to "true" in your main node (works if empty lines are olny in the end).
    2. Set "suppress_empty_nodes" to "true" in schemainfo (should work if empty lines are in the middle as well, might cause isses if missing values in records are possible).
    3. Add special "empty" elements that correspond to empty lines to your schema.
    4. Clean the file up in receive pipeline (Might require some codeing in your part).

    The first two options are the simplest to implement, other two require more work and are more error prone.

    Reference: Flat File dissasembling and empty rows problem

    Thanks,

    If my reply is helpful please mark as Answer or vote as Helpful.

    My blog | Twitter | LinkedIn

    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.


    Tuesday, December 29, 2015 5:11 PM
    Moderator
  • Hi,

    Thank you for posting in MSDN forum.

    I can see four solutions depending the exact issue:

    1. Set "suppress_trailing_delimiters" to "true" in your main node (works if empty lines are olny in the end).
    2. Set "suppress_empty_nodes" to "true" in schemainfo (should work if empty lines are in the middle as well, might cause isses if missing values in records are possible).
    3. Add special "empty" elements that correspond to empty lines to your schema.
    4. Clean the file up in receive pipeline (Might require some codeing in your part).

    The first two options are the simplest to implement, other two require more work and are more error prone.

    Thank you for answer.

    1) Empty lines can occur in the middle

    2) Suppress_empty_nodes does not work

    3) ?, probably don't work on my case.

    4) I need to clean file with send pipeline. Are there any samples available to clean up empty lines?

    I'm not 100% sure but i think that empty lines occurs because of CR LF. Is there way to fix this? I already tried settings on infix, postfix and prefix. 

    • Edited by Teammala Tuesday, December 29, 2015 5:31 PM
    Tuesday, December 29, 2015 5:27 PM
  • Hi,

    Thank you for posting in MSDN forum.

    I can see four solutions depending the exact issue:

    1. Set "suppress_trailing_delimiters" to "true" in your main node (works if empty lines are olny in the end).
    2. Set "suppress_empty_nodes" to "true" in schemainfo (should work if empty lines are in the middle as well, might cause isses if missing values in records are possible).
    3. Add special "empty" elements that correspond to empty lines to your schema.
    4. Clean the file up in receive pipeline (Might require some codeing in your part).

    The first two options are the simplest to implement, other two require more work and are more error prone.


    Thanks,

    If my reply is helpful please mark as Answer or vote as Helpful.

    My blog | Twitter | LinkedIn

    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

    Could have credited the post where you got it from:

    Flat File dissasembling and empty rows problem

    Tuesday, December 29, 2015 5:35 PM
  • Teammala, can you post the source and destination schemas?
    Tuesday, December 29, 2015 5:40 PM
  • Hi,

    Thank you for posting in MSDN forum.

    I can see four solutions depending the exact issue:

    1. Set "suppress_trailing_delimiters" to "true" in your main node (works if empty lines are olny in the end).
    2. Set "suppress_empty_nodes" to "true" in schemainfo (should work if empty lines are in the middle as well, might cause isses if missing values in records are possible).
    3. Add special "empty" elements that correspond to empty lines to your schema.
    4. Clean the file up in receive pipeline (Might require some codeing in your part).

    The first two options are the simplest to implement, other two require more work and are more error prone.

    Thank you for answer.

    1) Empty lines can occur in the middle

    2) Suppress_empty_nodes does not work

    3) ?, probably don't work on my case.

    4) I need to clean file with send pipeline. Are there any samples available to clean up empty lines?

    I'm not 100% sure but i think that empty lines occurs because of CR LF. Is there way to fix this? I already tried settings on infix, postfix and prefix. 

    Please have a look into below article for some reference,

    Remove empty nodes in BizTalk by using XSLT

    Thanks,

    If my reply is helpful please mark as Answer or vote as Helpful.

    My blog | Twitter | LinkedIn

    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

    Tuesday, December 29, 2015 5:47 PM
    Moderator
  • Teammala, can you post the source and destination schemas?

    I wish i could post these.. there are many elements that could reveal too much.

    Tuesday, December 29, 2015 5:54 PM
  • Hi,

    Thank you for posting in MSDN forum.

    I can see four solutions depending the exact issue:

    1. Set "suppress_trailing_delimiters" to "true" in your main node (works if empty lines are olny in the end).
    2. Set "suppress_empty_nodes" to "true" in schemainfo (should work if empty lines are in the middle as well, might cause isses if missing values in records are possible).
    3. Add special "empty" elements that correspond to empty lines to your schema.
    4. Clean the file up in receive pipeline (Might require some codeing in your part).

    The first two options are the simplest to implement, other two require more work and are more error prone.

    Thank you for answer.

    1) Empty lines can occur in the middle

    2) Suppress_empty_nodes does not work

    3) ?, probably don't work on my case.

    4) I need to clean file with send pipeline. Are there any samples available to clean up empty lines?

    I'm not 100% sure but i think that empty lines occurs because of CR LF. Is there way to fix this? I already tried settings on infix, postfix and prefix. 

    Please have a look into below article for some reference,


    I already tested this, i used this as a reference: https://talentedmonkeys.wordpress.com/2010/06/03/removing-empty-nodes-from-a-message-using-xslt-and-the-biztalk-mapper/

    I tested this with "test map"; it worked when destination schema was XML, not when dest.schema was Native. 



    • Edited by Teammala Tuesday, December 29, 2015 5:58 PM
    Tuesday, December 29, 2015 5:57 PM
  • If you are creating the flat file, the problem is that otherwise empty record elements are being crated in the Xml version, either in the previous Map or from the source.

    Most likely, the solution to this problem is in the Map.  You must suppress reason empty Records are created.

    • Marked as answer by Teammala Tuesday, December 29, 2015 8:46 PM
    Tuesday, December 29, 2015 6:52 PM
    Moderator
  • If you are creating the flat file, the problem is that otherwise empty record elements are being crated in the Xml version, either in the previous Map or from the source.

    Most likely, the solution to this problem is in the Map.  You must suppress reason empty Records are created.

    Well.. if you bang your head enough to the wall you finally find the answer :) As you suggested, problem was in the Map. All i had to do was to add one logical functoid.. Thank you!

    I thought i already tested this before but probably not the right way.

    Tuesday, December 29, 2015 8:46 PM