Reputation: 93
Please note the following data:
COMP - 416.00
DEVC - 16.00
DEVE - 32.00
ELEC - 64.00
YCL - 32.00
In Word I created a field with the following properties:
<?for-each:SSR_AIR_PARM?><?if:SSR_ENRL_CAT!='DEVC'?><?if:SSR_ENRL_CAT!='DEVE'?><?MIN_UNITS_REQD?><?end if?><?end if?><?end for-each?>
It gives the correct:
How do I sum that instead of putting out the three values?
ie. <?sum( 416, 64, 32 )?>
Upvotes: 1
Views: 3841
Reputation: 1589
<?sum(SSR_AIR_PARM[SSR_ENRL_CAT!='DEVC' and SSR_ENRL_CAT!='DEVE']/MIN_UNITS_REQD)?>
should also give the required answer,without a for loop, and without a variable. You can give the searchspec in those square brackets at the node level,and sum up the element under that node which meet the search criteria.
Upvotes: 1
Reputation: 93
I have managed to figure it out. For those interested:
<?xdoxslt:set_variable($_XDOCTX, ‘counter’, 0)?><?for-each:SSR_AIR_PARM?><?if:SSR_ENRL_CAT!='DEVC'?><?if:SSR_ENRL_CAT!='DEVE'?><?xdoxslt:set_variable($_XDOCTX, ‘counter’, xdoxslt:get_variable($_XDOCTX, ‘counter’) + MIN_UNITS_REQD)?><?end if?><?end if?><?end for-each?>
Then later I just used:
<?xdoxslt:get_variable($_XDOCTX, ‘counter’)?>
To retrieve the total.
Upvotes: 0