Problems with sorting

X-Application Version: 3.1.1
Tamino Version : 3.1.1.1
Platform : Win2k
WebContainer : Tamocat 4.0JDK

Hello,

I have generated an application using the Automatic generator. I want to sort whatever is displayed on browse.jsp according to values in a particular field.

The generated structure_XML.xml file has the XMl as follows







I want the list.jsp page to be sorted according to NUMBER

If I put a sort tage in the XSl file, and regenerate the application, it does not seem to work. I think it is because I do not know what exactly to specify in the select of the sort statement.

Here is the XSL code
In the sort statement, I have provided, select as @name[2]. I do not know whether this is correct. If I want to sort according to the NUMBER using the given XML, what should I do?

<xsl:for-each select=“display”>
<xsl:sort select=“@name[2]” order = “descending” />
<xsl:if test=“position()<=$config//output/maxBrowseElem/@value”>

<xsl:text disable-output-escaping=“yes”><bdm:display select=“</xsl:text>
<xsl:value-of select=”@select"/><xsl:text disable-output-escaping=“yes”>"/></xsl:text>
</xsl:if>
</xsl:for-each>

Hello,

As I understand your request correctly, you are using X-Application 3.1.1. Therefore, you can only use a X-Query expression to request documents. With X-Application 4.1.1 and Tamino 4.1.1 you could also use XQuery (standardized query languange of the w3c).

To your problem:

An X-Query to request your documents sorted by the element ‘NUMBER’ could look like this

/GEN-INFO[NAME ~= ‘N*’] sortby (./NUMBER)

With this expression a documents GEN-INFO with a NAME starting with ‘N’ would be returned. Their NUMBER would sort the returned set of the documents.

How to integrate a sort expression into an X-Application?

The generated search page contains the code that defines the query. It includes HTML-input tag that have a special code attribute ‘value’. In your case a tag could be

<input type="text" value="query[/GEN-INFO/NAME,~=)" /></pre><BR><BR>This tag is responsible to connect the text input of the tag to the filter of the query expression.<BR><BR>You can use also a special coding for the value attribute to get sortby clause. <BR><BR><pre class="ip-ubbcode-code-pre"><input type="hidden" value="querysort(/GEN-INFO/NUMBER)" />



For more details about building queries, have a look at the chapter ‘Defining and Processing Queries’.

Important: The input tag for sorting the document set has to be placed manually into your page. You don’t have to code the XSLTs of the generator. The idea is to use the generator for a basic application including 5 JSPs. For individual requirements the JSPs can be modified.
Only if you want to change the general output of the generator, adapt its XSLT to produce another set of JSPs.

Hint: There is a newer version 3.1.3 of X-Application working with Tamino 3.1.1 that you can download from

http://developer.softwareag.com/tamino/x-application/download_old.htm

This version contains a more flexible mechanism to query documents.

Bye,
Christian.

Hello,

Thank you very much for your reply.

I tried whatever you suggested.

Using X-Query
/GEN-INFO[NAME ~= ‘N*’] sortby (./NUMBER)

and


Nothing seems to work.

Any other suggestions will be much appreciated.

Thank you

Hello,

Excuse me. I made a mistake when describing the input parameters. The name of the HTML input tag must be ‘querysort’ and its value must be the sort clause.

Example



However, I would please you to download X-Application 3.1.3 and to look into the documentation. The chapter ‘Defining and Processing Queries’ contains examples based on the Property application.

Another argument for X-Application 3.1.3 is its additional flexible query mechanism. It allows you to define a parameterized X-Query. special coding of input tags is not require with this mechanism.

Bye,
Christian.