Community articleCreateCell function
Added by IBM contributorIBM on July 26, 2013
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

Description

Use this function to create a new cell item for a combobox, list, or popup. The CreateCell function adds one new cell to a group on a page in the form. Note that this function can only assign a name to the new cell; it cannot set the value of the cell. To set the value of a cell, you must use the SetLiteralByRefEx function.
This function is called from a page level node, and creates the new cell in that page. Note that you cannot call this function from the global page node.

Function

   Function CreateCell(
      theCellName As String, 
      theGroupName As String
      ) As IFormNodeP


Parameters

Table 1. Function parameters
ExpressionTypeDescription
theCellNameStringThe name of the new cell being created.
theGroupNameStringThe name of the group option to which the new cell will be added.


Returns

An IFormNodeP containing the new cell or throws an exception if an error occurs.

Example

The following function adds three cells to a form. First, the function uses DereferenceEx to locate the PAGE1 node. Next, the function calls CreateCell to create a new cell on that page and SetLiteralByrefEx to set the value of the new cell. The function then repeats these steps to create two more cells on that page.
   Sub AddCells(Form)
 
      Dim PageNode, CellNode  ' object
 
      Set PageNode = Form
 
      Set PageNode = PageNode.DereferenceEx(vbNullString, "PAGE1", 0, _
         UFL_PAGE_REFERENCE, Nothing)
 
      Set CellNode = PageNode.CreateCell("RedCell", "AvailableColors")
      CellNode.SetLiteralByRefEx vbNullString, "PAGE1.RedCell.value", 0, _
         vbNullString, Nothing, "Red"
 
      Set CellNode = PageNode.CreateCell("BlueCell", "AvailableColors")
      CellNode.SetLiteralByRefEx vbNullString, "PAGE1.BlueCell.value", 0, _
         vbNullString, Nothing, "Blue"
 
      Set CellNode = PageNode.CreateCell("GreenCell", "AvailableColors")
 
      CellNode.SetLiteralByRefEx vbNullString, "PAGE1.GreenCell.value", 0, _
         vbNullString, Nothing, "Green   "
 
   End Sub


Parent topic:
FormNodeP functions