Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 4th, 2006, 06:12 AM
Authorized User
 
Join Date: Sep 2006
Location: Cologne, , Germany.
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default Count() and filtering

Count & Filtering

I hope that someone can help me with this little issue:

With some reports I get very slow response from a generate-id clause ...

<xsl:for-each select="rep_base[generate-id()=generate-id(key('kteam', tm)[plant=$pfiltfld) and (FS_CNT != '')])]">

... so am switching to count() syntax which (in my case) is much faster. Here is an expample:

<xsl:for-each select="rep_base[count(.| key('kteam', tm)[1])=1 and (plant=$pfiltfld)]">

... which works fine (NB: Here all entries are allocated to one or other 'plant').

However, I would now like to add the second filter FS_CNT != '' (as in the first, generate-id, clause) to test for the entry of an FS_CNT item/attribute. Here I came up with the following syntax:

<xsl:for-each select="rep_base[count(.| key('kteam', tm)[FS_CNT != ''])=1 and (plant=$pfiltfld)]">

... but find that it doesn't seem to test all nodes. Let me explain:

I have some teams which, in some entries have FS_CNT data but in others do not. So, when I apply my FS_CNT != '' filter if the first entry for a team happens to be empty then the team will not be displayed even though other entries have data.

I am sure that this is a logic/understanding problem in my syntax and hope that someone can help me to correct this. Indeed, I have tried other variations such as:

<xsl:for-each select="rep_base[count(.| key('kteam', tm)[1])=1 and (plant=$pfiltfld) and (FS_CNT != '')]">

... but this gave me the same problem.

I could return to using 'generate-id' syntax but, although the correct data is returned, generate-id is extremely slow.

Here I really believe that, if I can get my mind around how the count() function accepts the filter clause, then I can get it to work.

Many thanks for any tips that you can give me.

Regards,
Alan.

Reply With Quote
  #2 (permalink)  
Old December 4th, 2006, 06:19 AM
Authorized User
 
Join Date: Sep 2006
Location: Cologne, , Germany.
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I was wondering ...

Could I do something like:

<xsl:for-each select="rep_base[count(.| key('kteam', tm)[max(FS_CNT)])=1 and (plant=$pfiltfld) and (FS_CNT != '')]">

... so that the count() clause always selects the top value (max) FS_CNT value and thereby is able to apply the FS_CNT != '' correctly.

This is stabbing in the dark and I did try this syntax but (of course) it didn't work.

Regards and thanks,
Alan Searle

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use OR during filtering..... raaj81 Reporting Services 0 July 30th, 2008 05:34 AM
XSL: Count = Count + 1 elayaraja.s XSLT 3 July 18th, 2008 03:21 AM
is there any in built function to count page count g.tamilselvan MySQL 1 February 15th, 2006 07:43 AM
Count, sum, count a value, return records CongoGrey Access 1 April 18th, 2005 02:25 PM
Chapter 4 - Filtering example pehrig BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 6 September 24th, 2004 02:39 PM



All times are GMT -4. The time now is 06:09 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.