CyberStore Ecommerce 2023 Documentation
SORQSO

See the example of SORQSO code below:

<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:param name="CustomerNumber" />
  <xsl:param name="StartDate" />
  <xsl:param name="EndDate" />
  <xsl:param name="SalesOrder" />
  <xsl:param name="CustomerPo" />
  <xsl:template match="/">
    <xsl:if test="$CustomerNumber='' ">
      <root />
      <!--no data specifed, provide XML that will return a trapped error.-->
    </xsl:if>
    <xsl:if test="$CustomerNumber!='' ">
      <Query xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance" xsd:noNamespaceSchemaLocation="SORQSO.XSD">
        <Filter>
          <Customer FilterType="S">
            <xsl:attribute name="FilterValue">
              <xsl:value-of select="$CustomerNumber" />
            </xsl:attribute>
          </Customer>
          <!--If a date, or a date span number is specified,use it.-->
          <xsl:if test="$StartDate!='' or  $EndDate!=''">
            <OrderDate>
              <!--determine which values have been specified and set FilterType and FilterValue as needed-->
              <xsl:choose>
                <xsl:when test="$StartDate!='' and $EndDate!=''">
                  <xsl:attribute name="FilterType">R</xsl:attribute>
                  <xsl:attribute name="FilterValue">
                    <xsl:value-of select="$StartDate" />,<xsl:value-of select="$EndDate" />
                  </xsl:attribute>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:attribute name="FilterType">S</xsl:attribute>
                  <xsl:attribute name="FilterValue">
                    <xsl:if test="$StartDate!=''">
                      <xsl:value-of select="$StartDate" />
                    </xsl:if>
                    <xsl:if test="$EndDate!=''">
                      <xsl:value-of select="$EndDate" />
                    </xsl:if>
                  </xsl:attribute>
                </xsl:otherwise>
              </xsl:choose>
            </OrderDate>
          </xsl:if>
          <!--If no dates have been specified, specified,use SalesOrder.-->

          <xsl:if test="$EndDate='' and $StartDate=''and $SalesOrder=''">
            <CustomerPo FilterType="R">
              <xsl:attribute name="FilterValue">
                <xsl:choose>
                  <xsl:when test="contains($CustomerPo,',')">
                    <xsl:value-of select="$CustomerPo" />
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:value-of select="$CustomerPo" />,<xsl:value-of select="$CustomerPo" />
                  </xsl:otherwise>
                </xsl:choose>
              </xsl:attribute>
            </CustomerPo>
          </xsl:if>
          <xsl:if test="$EndDate='' and $StartDate='' and $CustomerPo=''">
            <SalesOrder FilterType="R">
              <xsl:attribute name="FilterValue">
                <xsl:choose>
                  <xsl:when test="contains($SalesOrder,',')">
                    <xsl:value-of select="$SalesOrder" />
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:value-of select="$SalesOrder" />,<xsl:value-of select="$SalesOrder" />
                  </xsl:otherwise>
                </xsl:choose>
              </xsl:attribute>
            </SalesOrder>
          </xsl:if>
          <Salesperson />
          <Branch />
          <OrderType />

          <OrderStatus />
          <AlternateKey />
          <GeographicArea />
          <RequestedShipDate />
        </Filter>
        <Option>
          <IncludeCompletedOrders>Y</IncludeCompletedOrders>
          <IncludeCancelledOrders>Y</IncludeCancelledOrders>
          <IncludeForwardOrders>Y</IncludeForwardOrders>
        </Option>
      </Query>
    </xsl:if>
  </xsl:template>
</xsl:stylesheet>