Menu

setDefinedNameValue

This command requires extra license.

A child command for modifyWorkbook that sets a new value for a cell referenced by a defined name. If the defined name refers to an area rather than a single cell, the new value is set into the first (top-left) cell of the area.

Parent commands

  • modifyWorkbook
    Required. This parent defines the workbook that is modified.

Attributes

name

Required
Value type
EL-evaluated
Yes String Yes
Defines the defined name whose cell receives the new value. 
value

Required
Value type
EL-evaluated
Yes Any Yes
Defines the new value of the cell. If the resolved value is a Number or a Boolean, the cell's type is set to numeric or boolean, as appropriate. If the value is an empty String, the cell's value is set to null. If it's a value of any other type, that value is converted into a String and the cell type set to text.

Examples

Add one setDefinedNameValue command for every defined name whose referenced value you wish to modify.

<modifyWorkbook var="modifiedWorkbook" workbook="${workbook}">
  <setDefinedNameValue name="CarrotPrice" value="${newCarrotPrice}">
  <setDefinedNameValue name="BlueberryShipments" value="${expectedBBShipments}">

If you're setting fixed values into cells, be particularly careful when setting numbers. A number that is not wrapped with the EL-expression notation is actually a String, and String values do not function as the numbers they may look like when they are components of formula cells' calculations. So, if you'd like to set a cell's value as the number 15 for example, set the value attribute into ${15}, not 15.  

Also see the documentation of evalFormulas for an example of using this command to execute dynamic formula alterations.

Comments

0 comments