Solved

xml filter

Posted on 2006-06-26
3
247 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 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
A short article about problems I had with the new location API and permissions in Marshmallow
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Progress

632 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