Social media


            

Tuesday, December 22, 2009

Mathematical operations in Workbox

As you may have noticed, inputting "3+5" in the activity parameter will return "3+5". What to do, to receive (in this case) "8"?

To perform the calculation you need to pass the equation to a variable using "set variable" activity or use the "calculate" math function.
NOTE: The variable which will receive the equation must be of "double" or "integer" type. Only then the calculations will be performed.

Later, you can use this variable in other lookup fields.

So, for example - you want to take data from one SharePoint item field, subtract it from another field and put the equation result into another SharePoint item field. To do this:

  • In the activities window add "edit item" activity and double click it to enter the details
  • Pick the list, filters and field you want to add the new value.
  • Open the new value field
  • Click on the "Lookup" button
  • Go to functions -> math ->calculate
  • Click on the value textbox, new window will appear
  • Pick (using lookups) value of the selected SharePoint item field
  • enter minus sign
  • The equation should look like this (without quotation marks) "[list_name - field_name] - [list_name2 - field_name2]"
  • Click ok,
Now Workbox will do the calculation instead of treating the values as text.

You can use the following functions:
  • ^
  • +
  • -
  • /
  • *
  • cos
  • sin
  • exp
  • ln
  • tan
  • acos
  • asin
  • atan
  • cosh
  • sinh
  • tanh
  • sqrt
  • cotan
  • fpart
  • acotan
  • round
  • ceil
  • floor
  • fac
  • sfac
  • abs
  • log
  • %
  • >
  • <
  • &&
  • ==
  • !=
  • ||
  • !
  • >=
  • <=
and constants:
  • euler
  • pi
  • nan
  • infinity
  • true
  • false