none
I have a flat file schema I have been making 2 schemas one for what I call full file with data and one for what I call an empty file without data RRS feed

  • Question

  • Is there a way to combine this into one schema? I thought if I set the Min Occurs to 0 then that would work but it does not?

    Thanks

    Monday, July 2, 2012 7:02 PM

All replies

  • Can you elaborate a bit on where these schemas are used (Send Pipeline, Receive Pipeline, etc)?  Can you also include sample input data (full vs empty)?


    David Downing... If this answers your question, please Mark as the Answer. If this post is helpful, please vote as helpful.

    Monday, July 2, 2012 8:25 PM
  • The schema is  used in a map to insert into a database thanks

    single record:

    PHYSICIAN:  COOK,Bat Man W305-2|Catwoman,BABY BO|11/07/1963|2d|M|9999999999|8888888888|V20.00-SIN LB IN-HOSP |3|(555)555-1212|woman,cat A
    bhp REPORTS END
    11/19/1963

    empty file:

    bhp REPORTS END
    07/01/2012

    Monday, July 2, 2012 8:43 PM
  • From your flat file above, I am assuming that you use the schemas in the receive pipeline which includes a flat file disassembler... is that correct?

    David Downing... If this answers your question, please Mark as the Answer. If this post is helpful, please vote as helpful.

    Monday, July 2, 2012 8:47 PM
  • Yes I am new at this but I believe that is the route to take I am just doing maps and schemas right now
    Monday, July 2, 2012 8:51 PM
  • You should be able to get this working by structuring the schema as follows:

    If you can't seem to get it working, I can take a look at your schema(s).   Send me the schema(s) and your two test instances (please zip them up as an attachment).

    My MSDN email is: ddownin@hotmail.com


    David Downing... If this answers your question, please Mark as the Answer. If this post is helpful, please vote as helpful.


    Monday, July 2, 2012 9:00 PM
  • It might help

    Example 2 - A complex positional flat file


    Thanks, Raja MCTS BizTalk Server 2010, MCC If this answers your question please mark it accordingly

    Tuesday, July 3, 2012 8:57 AM
  • Here you go David Thanks I will email to you now
    Thursday, July 5, 2012 6:14 PM
  • I just sent you the updated schema.  The schema was structured as follows:


    David Downing... If this answers your question, please Mark as the Answer. If this post is helpful, please vote as helpful.


    Thursday, July 5, 2012 7:51 PM
  • Almost David this is very close but not quite!

    I have a funtoid in the map that always puts in the name of the type of file in this case peds  and the report_date at the bottom.

    thank you

    ps this is because we need to track when we get an empty file

    Thanks

    Thursday, July 5, 2012 8:07 PM
  • I'll take a look and see what I can do.


    David Downing... If this answers your question, please Mark as the Answer. If this post is helpful, please vote as helpful.

    Thursday, July 5, 2012 8:38 PM
  • I couldn't seem to get the attributes mapping when the Physician element didn't exist, so I provided a custom XSLT script.  If someone has experience mapping attribute elements in a similar scenario, please chime in.  The Table_Name and Received_Date attributes don't seem to map if the Physician element doesn't exist.

    The Map is as follows (Unrelated links removed for simplification):

    The custom XSLT is as follows (unrelated links removed for simplification):

    <?xml version="1.0" encoding="utf-16"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var" exclude-result-prefixes="msxsl var s0 userCSharp" version="1.0" xmlns:ns0="http://TMH_Census" xmlns:s0="http://Census.Schemas.TMH_Peds" xmlns:userCSharp="http://schemas.microsoft.com/BizTalk/2003/userCSharp">
    	<xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />
    	<xsl:template match="/">
    		<xsl:apply-templates select="/s0:Root" />
    	</xsl:template>
    	<xsl:template match="/s0:Root">
    		<ns0:Census_Request>
    			<ns0:sync>
    				<ns0:after>
    					<xsl:if test="count(Physician) != '0'">
    						<xsl:for-each select="Physician">
    							<xsl:for-each select="Patient_Data">
    								<xsl:variable name="var:v1" select="userCSharp:StringConcat(&quot;Peds&quot;)" />
    								<ns0:Census>
    									<xsl:attribute name="Table_Name">
    										<xsl:value-of select="$var:v1" />
    									</xsl:attribute>
    									<xsl:attribute name="Received_Date">
    										<xsl:value-of select="Report_Date/text()" />
    									</xsl:attribute>
    								</ns0:Census>
    							</xsl:for-each>
    						</xsl:for-each>
    					</xsl:if>
    					<xsl:if test="count(Physician) = '0'">
    						<xsl:variable name="var:v1" select="userCSharp:StringConcat(&quot;Peds&quot;)" />
    						<ns0:Census>
    							<xsl:attribute name="Table_Name">
    								<xsl:value-of select="$var:v1" />
    							</xsl:attribute>
    							<xsl:attribute name="Received_Date">
    								<xsl:value-of select="Report_Date/text()" />
    							</xsl:attribute>
    						</ns0:Census>
    					</xsl:if>
    				</ns0:after>
    			</ns0:sync>
    		</ns0:Census_Request>
    	</xsl:template>
    	<msxsl:script language="C#" implements-prefix="userCSharp">
    		<![CDATA[
    public string StringConcat(string param0)
    {
       return param0;
    }
    
    
    
    ]]>
    	</msxsl:script>
    </xsl:stylesheet>

    David Downing... If this answers your question, please Mark as the Answer. If this post is helpful, please vote as helpful.




    Friday, July 6, 2012 4:47 PM
  • If you're still looking for an solution using the biztalk mapper, I would be glad to help find the answer.

    You can just send me the mapping file with both schema's to mitch.vanhelden@gmail.com.

    Monday, July 9, 2012 11:21 AM