1 Reply Latest reply: Apr 17, 2012 12:11 PM by BIPuser RSS

    How to assign a value to a variable

    633466
      Hi All,

      Need your inputs to solve my issue.
      My requirement is to getting the running total based on the value derived from the if condition.
      Below code i used to row level value.
      <?xdofx:if (nvl(ADDITION,0) >0 and nvl(ASSET_COUNT,0) > 1 )  then FIXED_ASSETS_COST     else      ADDITION   end if?>
      this will return value like below.

      -63.92
      -8.32
      168.13
      -49.91
      1,008.73
      -8.32
      168.13

      I need to sum all those values and return 1,214.52 i need to assign those values to a variable and do the sum.
      Used below code
      <?xdofx:if (nvl(ADDITION,0) >0 and nvl(ASSET_COUNT,0) > 1 )?><?xdoxslt:set_variable($_XDOCTX, 'RTotVar', xdoxslt:get_variable($_XDOCTX, 'RTotVar') + FIXED_ASSETS_COST)?><?end if?>
      But it is not working.
      Please provide your inputs in achieving the same.
      Thanks
      Rajesh
        • 1. Re: How to assign a value to a variable
          BIPuser
          When you say that it is not working, do you mean that the code is not providing the desired output? Is there an error relating to the use of xdofx and xdoxslt functions?

          Change your second "if" statement to:

          <?if:(nvl(ADDITION,0) >0 and nvl(ASSET_COUNT,0) > 1)?><?xdoxslt:set_variable($_XDOCTX, 'RTotVar', xdoxslt:get_variable($_XDOCTX, 'RTotVar') + FIXED_ASSETS_COST)?><?end if?>


          Thanks,
          Bipuser