Recently I faced a new requirement in TIBCO. My Requirement is to validate input csv file and acknowledge the details of missing values. Below is the sample csv data
csv data with all values:
csv data with missing values:
so how to acknowledge missing values in each line, each value. below is the simple solution i did:
Step 1: Read Palette read .csv file.
Step 2: Use ParseData Palette and parse the data to XML. below is the XML after reading and parsing .csv data. which has missing values in transformed XML.

Step 3: Here the trick , now use Render palette and convert XML to XMLString as below

Step 4: create xsl resource and copy paste below XSL code to validate xml
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:p="http://www.tibco.com/schemas/prjDelimeter/Schema/Schema2.xsd">
<xsl:output omit-xml-declaration="yes" />
<xsl:template match="/">
<xsl:apply-templates mode="rule1"
select="p:Organisation/p:EMP/p:ID">
</xsl:apply-templates>
<xsl:apply-templates mode="rule2"
select="p:Organisation/p:EMP/p:Name">
</xsl:apply-templates>
<xsl:apply-templates mode="rule3"
select="p:Organisation/p:EMP/p:Designation">
</xsl:apply-templates>
<xsl:apply-templates mode="rule4"
select="p:Organisation/p:EMP/p:ExpertiseIn">
</xsl:apply-templates>
<xsl:apply-templates mode="rule5"
select="p:Organisation/p:ASSETS">
</xsl:apply-templates>
</xsl:template>
<!-- Employee data Validation -->
<xsl:template match="p:ID" mode="rule1">
<xsl:if test="current() = ''">
Employee ID is empty.
</xsl:if>
</xsl:template>
<xsl:template match="p:Name" mode="rule2">
<xsl:if test="current() = ''">
Employee Name is empty.
</xsl:if>
</xsl:template>
<xsl:template match="p:Designation" mode="rule3">
<xsl:if test="current() = ''">
Employee Designation is empty.
</xsl:if>
</xsl:template>
<xsl:template match="p:ExpertiseIn" mode="rule4">
<xsl:if test="current() = ''">
ExpertiseIn data can't be empty.
</xsl:if>
</xsl:template>
<!-- Assets data Validation -->
<xsl:template match="p:ASSETS/*" mode='rule5'>
<xsl:variable name="i" select="count(preceding-sibling::*)+1" />
<xsl:for-each select="child::*">
<xsl:if test="current() = '' ">
<xsl:value-of select="local-name()" /> in Line- <xsl:value-of select="$i" /> with Position-<xsl:value-of select="count(preceding-sibling::*)+1" /> is empty
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Step 5: Use Transform palette under configuration tab >set "style sheet" parameter to use above xsl and set "Input and Output Style" to Text. and pass RenderXML>XMLString to TransformXml>XMLString.
And configure Transform palette > Input as below

and set a "Generate Error" palette and in input tab map >$Validate-XML variable to GenerateError>ActivityInput>Message and set Transition line with Condition as below to see if XSLgives output or not, so i kept this condition to see if xmlString is null. if it's not null then am assuming as my transformed csv file is having some missing values, else it's a valid csv file.

Step 6: Run process definition with missing csv values as shown in image 2.

in the result we will have list of missing values what we have in input csv file.
Else we Input XML is valid and our process will successful transaction.
Happy solution :)
csv data with all values:
csv data with missing values:
so how to acknowledge missing values in each line, each value. below is the simple solution i did:
Step 1: Read Palette read .csv file.
Step 2: Use ParseData Palette and parse the data to XML. below is the XML after reading and parsing .csv data. which has missing values in transformed XML.
Step 3: Here the trick , now use Render palette and convert XML to XMLString as below
Step 4: create xsl resource and copy paste below XSL code to validate xml
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:p="http://www.tibco.com/schemas/prjDelimeter/Schema/Schema2.xsd">
<xsl:output omit-xml-declaration="yes" />
<xsl:template match="/">
<xsl:apply-templates mode="rule1"
select="p:Organisation/p:EMP/p:ID">
</xsl:apply-templates>
<xsl:apply-templates mode="rule2"
select="p:Organisation/p:EMP/p:Name">
</xsl:apply-templates>
<xsl:apply-templates mode="rule3"
select="p:Organisation/p:EMP/p:Designation">
</xsl:apply-templates>
<xsl:apply-templates mode="rule4"
select="p:Organisation/p:EMP/p:ExpertiseIn">
</xsl:apply-templates>
<xsl:apply-templates mode="rule5"
select="p:Organisation/p:ASSETS">
</xsl:apply-templates>
</xsl:template>
<!-- Employee data Validation -->
<xsl:template match="p:ID" mode="rule1">
<xsl:if test="current() = ''">
Employee ID is empty.
</xsl:if>
</xsl:template>
<xsl:template match="p:Name" mode="rule2">
<xsl:if test="current() = ''">
Employee Name is empty.
</xsl:if>
</xsl:template>
<xsl:template match="p:Designation" mode="rule3">
<xsl:if test="current() = ''">
Employee Designation is empty.
</xsl:if>
</xsl:template>
<xsl:template match="p:ExpertiseIn" mode="rule4">
<xsl:if test="current() = ''">
ExpertiseIn data can't be empty.
</xsl:if>
</xsl:template>
<!-- Assets data Validation -->
<xsl:template match="p:ASSETS/*" mode='rule5'>
<xsl:variable name="i" select="count(preceding-sibling::*)+1" />
<xsl:for-each select="child::*">
<xsl:if test="current() = '' ">
<xsl:value-of select="local-name()" /> in Line- <xsl:value-of select="$i" /> with Position-<xsl:value-of select="count(preceding-sibling::*)+1" /> is empty
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Step 5: Use Transform palette under configuration tab >set "style sheet" parameter to use above xsl and set "Input and Output Style" to Text. and pass RenderXML>XMLString to TransformXml>XMLString.
And configure Transform palette > Input as below
and set a "Generate Error" palette and in input tab map >$Validate-XML variable to GenerateError>ActivityInput>Message and set Transition line with Condition as below to see if XSLgives output or not, so i kept this condition to see if xmlString is null. if it's not null then am assuming as my transformed csv file is having some missing values, else it's a valid csv file.
Step 6: Run process definition with missing csv values as shown in image 2.
in the result we will have list of missing values what we have in input csv file.
Else we Input XML is valid and our process will successful transaction.
Happy solution :)