GIS/SI Envelopes Report (I)

Problem

Sometimes users need to have a detailed report about the envelopes they have in GIS/SI, but GIS doesn’t have such functionality. For example, you want to have a list of ISA/GS envelopes with the names, Sender/ReceiverIDs but there is no built-in functionality to get it easily. So, you have to check envelopes one by one (which is not very useful).

Solution 1

Fortunately, there are several ways to get this information. One of them is to export envelopes you need into an XML file and transform it into HTML report with using of XSLT.

Let me show how to create a simple report. For example, you use the following names for your envelopes:

[COMPANY NAME]_[TP NAME]_[I or O (inbound/outbound)]_[TYPE (ISA/GS/ST)]_[DOC ID (850/810/…]

and if your TP is WALMART and you use 810, 850 and 997 there will be the following envelopes:

  • COMPANYNAME_WALMART_I_ISA
  • COMPANYNAME_WALMART_I_GS_850
  • COMPANYNAME_WALMART_I_ST_850
  • COMPANYNAME_WALMART_I_GS_997
  • COMPANYNAME_WALMART_I_ST_997
  • COMPANYNAME_WALMART_O_ISA
  • COMPANYNAME_WALMART_O_GS_810
  • COMPANYNAME_WALMART_O_ST_810
  • COMPANYNAME_WALMART_O_GS_997
  • COMPANYNAME_WALMART_O_ST_997

And you need to get the list of Envelope/Sender/Receiver/Document. Your XSLT might be something like this:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="html" indent="yes"/>
	<xsl:template match="/">
		<html>
			<table width="100%" border="1">
				<tr>
					<td align="center">
						#
					</td>
					<td align="left" valign="top">
						<b>Envelope</b>
					</td>
					<td align="left" valign="top">
						<b>Sender</b>
					</td>
					<td align="left" valign="top">
						<b>Receiver</b>
					</td>
					<td align="left" valign="top">
						<b>Document</b>
					</td>
				</tr>
				<xsl:for-each select="//ENVELOPE">
					<xsl:sort select="concat( substring-before(substring-after(NAME, '_'), '_'), FUNCTION, not(TYPE = 'ISA IEA'), substring(normalize-space(NAME), string-length(normalize-space(NAME)) - 2, 3) )"/>

					<tr>
						<td align="right" valign="top">
							<xsl:value-of select="position()"/>
						</td>
						<td align="left" valign="top">
							<xsl:value-of select="NAME"/>
						</td>
						<td align="left" valign="top">
							<xsl:value-of select="SENDER_ID"/>
							<xsl:if test="normalize-space(./ENVELOPE_PARMS/ENVELOPE_PARM[NAME = 'InterchangeSenderIDQualifier']/VALUE) != ''">
								[<xsl:value-of select="./ENVELOPE_PARMS/ENVELOPE_PARM[NAME = 'InterchangeSenderIDQualifier']/VALUE"/>]
							</xsl:if>
						</td>
						<td align="left" valign="top">
							<xsl:value-of select="RECEIVER_ID"/>
							<xsl:if test="normalize-space(./ENVELOPE_PARMS/ENVELOPE_PARM[NAME = 'InterchangeReceiverIDQualifier']/VALUE) != ''">
								[<xsl:value-of select="./ENVELOPE_PARMS/ENVELOPE_PARM[NAME = 'InterchangeReceiverIDQualifier']/VALUE"/>]
							</xsl:if>
						</td>
						<td align="left" valign="top">
							<xsl:if test="TYPE != 'ISA IEA'">
								<xsl:value-of select="substring(normalize-space(NAME), string-length(normalize-space(NAME)) - 2, 3)"/>
							</xsl:if>
						</td>
					</tr>
				</xsl:for-each>
			</table>
		</html>
	</xsl:template>
</xsl:stylesheet>

Please note that xsl:sort condition depends on your envelopes naming format.

Next, open Export.xml in text editor, remove all the attributes from <SI_RESOURCES> element and add a link to your XSLT:
<?xml-stylesheet type=”text/xsl” href=”_style_c.xsl”?>

Open Export.xml in MS Internet Explorer for example and you’ll see something like this:

Gennady Kim

Advertisements

One thought on “GIS/SI Envelopes Report (I)

  1. Pingback: GIS/SI Envelopes Report (II) | EDI shortcuts

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s