473,320 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Nested Predicates

I need to access the primary context in a nested predicate and for the
life of me I don't know how to do it.

What I want to do is select the Applicant with any income in a single
XPath query.

Here is a snippet of xml:

<Application>
<Applicant Id="xxxx">...</Applicant>
<Financial>
<Income Id="yyyy">
<Amount>24000</Amount>
<Reference Applicant="xxxx"/>
</Income>
...
</Financial>
</Application>

The XPath is:

Application/Applicant[sum(/Application/Financial/Income[Reference/@Applicant=@Id]/Amount)
0]
The problem is, the @Id above is in the context of the *Income* but I
want it to be in the context of the *Applicant*

Any pointers ?

TIA

Dominic

Sep 19 '06 #1
3 1461
You might try using the current() function:

Application/Applicant[sum(/Application/Financial/Income[Reference/@Applicant=current()/@Id]/Amount) 0]

Not sure in your situation whether it will refer you back to Applicant or to the root node. Give it a shot.

--
Greg Collins [Microsoft MVP]
Visit Brain Trove ( http://www.BrainTrove.com )
Sep 19 '06 #2
This will refer you back to the Applicant node, but the problem is,
current() cannot be used when matching/selecting. It can only be used
in evaluation.

We need something that will work in a match/select context.

Any ideas ?

Greg Collins [Microsoft MVP] wrote:
You might try using the current() function:

Application/Applicant[sum(/Application/Financial/Income[Reference/@Applicant=current()/@Id]/Amount) 0]

Not sure in your situation whether it will refer you back to Applicant or to the root node. Give it a shot.

--
Greg Collins [Microsoft MVP]
Visit Brain Trove ( http://www.BrainTrove.com )
Sep 20 '06 #3
Can you provide a really complete XML document?

From your "snippet" it is not easy to understand the problem.

Cheers,
Dimitre Novatchev.

<dm********@verdantsys.comwrote in message
news:11**********************@m7g2000cwm.googlegro ups.com...
>I need to access the primary context in a nested predicate and for the
life of me I don't know how to do it.

What I want to do is select the Applicant with any income in a single
XPath query.

Here is a snippet of xml:

<Application>
<Applicant Id="xxxx">...</Applicant>
<Financial>
<Income Id="yyyy">
<Amount>24000</Amount>
<Reference Applicant="xxxx"/>
</Income>
...
</Financial>
</Application>

The XPath is:

Application/Applicant[sum(/Application/Financial/Income[Reference/@Applicant=@Id]/Amount)
>0]

The problem is, the @Id above is in the context of the *Income* but I
want it to be in the context of the *Applicant*

Any pointers ?

TIA

Dominic

Sep 20 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Ike | last post by:
I am hoping someone can help me with the proper syntax for this. I have an attribute, called, say "name," such that: <set name="something">thename</set> However, the value for name, is...
2
by: Thong Nguyen | last post by:
I wrote my own Predicate class for .NET 1.1 which allowed composite predicates using operator overloading... for example: Predicate p1 = {...}; Predicate p2 = {...}; Predicate p1andp2 =...
0
by: dayzman | last post by:
Hi, M'm writing a program to output the results of transforming logical predicates using deMorgan's. Does anyone know of a library that handles logical predicates? Cheers, Michael
3
by: Tcs | last post by:
My backend is DB2 on our AS/400. While I do HAVE DB2 PE for my PC, I haven't loaded it yet. I'm still using MS Access. And no, I don't believe this is an Access question. (But who knows? I...
2
by: Praveen | last post by:
Hi, Hi I am a newbie in DB2 and Mainframe.I would like to know if there is any diffence between the Quantified Predicates: IN , ANY, and SOME. Thank you very much for your valuable time. ...
2
by: smauldin | last post by:
Why does the execution plan have a nested loop join for a simple select with an UDF in the where clause? Here is the query: select * from test_plan where vCol = my_udf('test') Here is the...
12
by: desktop | last post by:
Are there any performance issues between: bool run = true; while(run) { if (bob1 &&){ //dothing break; }
7
balabaster
by: balabaster | last post by:
Okay, after having bashed my head against this long enough I thought of you guys... I thought having exhausted just about every other .NET concept I would come back to predicates because Microsoft's...
0
by: raylopez99 | last post by:
Inspired by Jon, I did a demo prorgram showing three ways to declare predicates, in for example the "FindIndex" and "FindLastIndex" methods of Lists, but in general you can do this for any...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.