1

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:

  • 416
  • 64
  • 32

How do I sum that instead of putting out the three values?

ie. <?sum( 416, 64, 32 )?>

XantorAmnobius
  • 93
  • 1
  • 10

2 Answers2

1
<?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.

Ranjith R
  • 1,571
  • 1
  • 11
  • 11
0

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.

XantorAmnobius
  • 93
  • 1
  • 10