[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

query help

Taranmeet Kindra taranmeet.kindra at india.birlasoft.com
Wed Sep 20 18:11:37 PDT 2006


  query help


Hello

I want to write a query that would check if job code given in
//BasicInfo/JobGroups/JobGroup/JobCodes/JobCode/text()

Is among one of them specified at
//BasicInfo/Divisions/Division/Locations/Location/Departments/Department
/JobCode

If not then I would like the query to return that job code.

Here a section of XML

			<Divisions>
				<Division DivisionCode="003">
					<Locations>
						<Location Code="MS385">
							<Departments>

<Department DepartmentCode="MBYC">

<JobCode>3694000</JobCode>

<JobCode>0550006</JobCode>

</Department>
							</Departments>
						</Location>
					</Locations>
				</Division>
			</Divisions>
			<JobGroups>
				<JobGroup GroupName="0001">
					<JobCodes>

<JobCode>301888</JobCode>
					</JobCodes>
					<JobAccumulatorCode>
</JobAccumulatorCode>
				</JobGroup>
				<JobGroup GroupName="0002">
					<JobCodes>

<JobCode>301882</JobCode>
					</JobCodes>
					<JobAccumulatorCode>
</JobAccumulatorCode>
				</JobGroup>
				<JobGroup GroupName="0003">
					<JobCodes>

<JobCode>302098</JobCode>
					</JobCodes>
					<JobAccumulatorCode>
</JobAccumulatorCode>
				</JobGroup>
				<JobGroup GroupName="0004">
					<JobCodes>

<JobCode>302044</JobCode>

<JobCode>302045</JobCode>
					</JobCodes>
					<JobAccumulatorCode>
</JobAccumulatorCode>
				</JobGroup>
			</JobGroups>




I tried following few queries none of them give desired results


----------------not working--------------------------------------

let $result
for $Bcode in
//BasicInfo/Divisions/Division/Locations/Location/Departments/Department
/JobCode/text()
for $grp in //BasicInfo/JobGroups/JobGroup
for $code in $grp/JobCodes/JobCode/text(){
if (not(  compare($Bcode,$code)))
$result:= concat($result, $code)
}
return $result


--------------------not working---------------
let $result:= ()
for $Bcode in
//BasicInfo/Divisions/Division/Locations/Location/Departments/Department
/JobCode/text()
for $grp in //BasicInfo/JobGroups/JobGroup
for $code in $grp/JobCodes/JobCode/text()
return if (not(  compare($Bcode,$code)))
		then $code
		else (ok)

--------------------not working---------------------------------------
let $Bcode :=
//BasicInfo/Divisions/Division/Locations/Location/Departments/Department
/JobCode/text()
for $code in //BasicInfo/JobGroups/JobGroup/JobCodes/JobCode/text()
return if (not(contains($Bcode,$code)))
		then $code
		else (ok)



your insight would be very helpful

Thanks
Taran

*********************************************************************************************************************************************************************
"This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient,any disclosure,copying, use, or distribution of the information included in this message and any attachments is
prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you."
*********************************************************************************************************************************************************************



Purchase Stylus Studio Online Today!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.