Solved

xml filter

Posted on 2006-06-26
3
241 Views
Last Modified: 2011-09-20
Hi Experts

 i am new to xml, i am writing the xquery in my project.
this is the one i am using
let $nTitlePath1 := doc(concat( $nFOLDER,"TITLES.xcs"))/TABLES/TITLES/TITLE[@TITLETYPEID =$nTITLETYPEID and @COURSEVERSIONID=$nCOURSEVERSIONID and @TOPIC = "if($nCHAPTERSONLY  = 0) then (@TOPIC) else ($nCHAPTERSONLY)"  and @SUBTOPIC = "if($nCHAPTERSONLY  =  0) then (@SUBTOPIC) else ($nCHAPTERSONLY)"   and @MICROTOPIC ="if($nCHAPTERSONLY  =  0) then (@MICROTOPIC) else ($nCHAPTERSONLY)" ]

here  nCHAPTERSONLY=0,  nCOURSEVERSIONID  = 38
this is returning the empty <ROWS>

can i assign the filte likt this   @TOPIC = "if($nCHAPTERSONLY  = 0) then (@TOPIC) else ($nCHAPTERSONLY)"

this is not returning any value
when i use @TOPIC = @TOPIC it is returning all the values int he file.

please give me the suggestion on this


thanks in adv


regards
karunakar
0
Comment
Question by:karunakarrreddy
3 Comments
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 20 total points
ID: 16983185
> when i use @TOPIC = @TOPIC it is returning all the values int he file.
of course because the test is always true

> can i assign the filte likt this   @TOPIC = "if($nCHAPTERSONLY  = 0) then (@TOPIC) else ($nCHAPTERSONLY)"
it is not really assign, it is a compare, but you can do it that way

if $nCHAPTERSONLY  = 0 it should be true
note that XQuery is strongly typed and doesn't do autocasting...
you might need if($nCHAPTERSONLY  = xs:string( 0) )

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

RIA (Rich Internet Application) tools are interactive internet applications which have many of the characteristics of desktop applications. The RIA tools typically deliver output either by the way of a site-specific browser or via browser plug-in. T…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now