Search the web
Sign In
New User? Sign Up
xrules · XRules & DynamicDOM
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
I found ... :)   Message List  
Reply | Forward Message #54 of 74 |
RE: [xrules] I found ... :)

Hi Sassan,

    You found a correct solution. Another way you can use is to create your rules as follows:

 

<xr:ruleset context="/Questionnaire/PartList/Part/FLN[CFLN]">

<xr:calculate target="Total" createNode="last">

<xr:value>sum(CFLN)</xr:value>

</xr:calculate>

</xr:ruleset>

 

 

    In the above rule, instead of checking for the “Total” element, we look to see if there are child <CFLN> elements which indicate that a total amount needs to be calculated. Then, we let the <calculate> rule create the <Total> element by adding the createNode=”last” attribute. It gets us the same result, but you don’t have to create the <Total> element in your source document.

 

Regards,

Waleed

 

 

 

-----Original Message-----
From: xrules@yahoogroups.com [mailto:xrules@yahoogroups.com] On Behalf Of radobject
Sent: Saturday, January 13, 2007 4:26 PM
To: xrules@yahoogroups.com
Subject: [xrules] I found ... :)

 

Hi,
If you want calculate some fields and set result into another xml
element but you don't know that all tag has it. You can use this
XRule.

My XML data :
<Part>
<ID>1</ID>
<FLN ID="F051601001">ÂÓãÇä ÂÈ&#1740;</FLN>
<FLN ID="F051601002">3400</FLN>
<FLN ID="F051601003">40</FLN>
</Part>
<Part>
<ID>2</ID>
<FLN ID="F051601004">
<CFLN ID="1">10</CFLN>
<CFLN ID="2">2</CFLN>
<CFLN ID="3">4</CFLN>
<Total/>
</FLN>
</Part>

and I wrote this XRule : (Some FLN do't have a Total tag)

<?xml version="1.0" encoding="utf-16"?>
<xr:rules xmlns:xr="http://www.xrules.org/2003/11">
<xr:ruleset context="/Questionnaire/PartList/Part/FLN
[Total='']">
<xr:calculate target="Total">
<xr:value>sum(CFLN)</xr:value>
</xr:calculate>
</xr:ruleset>
</xr:rules>

Best regards
Sasan Nikookar



Sun Jan 14, 2007 5:38 am

waleed_ka
Offline Offline
Send Email Send Email

Forward
Message #54 of 74 |
Expand Messages Author Sort by Date

Hi, If you want calculate some fields and set result into another xml element but you don't know that all tag has it. You can use this XRule. My XML data : ...
radobject
Offline Send Email
Jan 14, 2007
3:25 am

Hi Sassan, You found a correct solution. Another way you can use is to create your rules as follows: <xr:ruleset...
Waleed K. Abdulla
waleed_ka
Offline Send Email
Jan 14, 2007
5:41 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help