Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

xml filter

Posted on 2006-06-26
3
Medium Priority
?
248 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 80 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
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 …

715 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