Startform

You can use the StartForm function to open an Optiva form.

Note: 
  • Use multiple statements to open more than one form at a time.
  • Use it in the VIEW and EDIT events.

When to use

You can use this function to:

  • Open forms programmatically from workflows.
  • Open multiple forms simultaneously.
  • In Wizard workflows that create objects, to open the newly created object for the user.
  • Create rules do not require this function.

Syntax

int Startform(string formName, string objKey, string args);

Parameters

Parameter Type Required Description
formName string Yes The name of the form to open. Form names begin with "FRM" prefix. Common form names:
  • FRMITEM - Item form
  • FRMFORMULA - Formula form
  • FRMSPECIFICATION - Specification form
  • FRMPROJECT - Project form
  • FRMCOMPARE - Comparison form (requires special args format)
  • FRMLABELCONTENT - Label Content form
  • FRMLABEL – Ingredient Statement form
objKey string No The object key or code to open in the form.
args string No Additional arguments required by specific forms.
Note: 
  • Format depends on the form being opened.
  • Most forms do not require this parameter.
Note: The Form tab of the Role form has a list of all form names.

Return Value

The application returns a value greater than zero (0) if the operation is successful.

Impact

  • Opens a form window in the user interface.
  • The form becomes active and visible to the user.

Prerequisites

Some forms may have additional constraints.

Examples

Example 1
Basic usage – Open an Item
long iOpen = StartForm("frmitem","TOMATOES");
Description
This example determines to open the Item form for TOMATOES.
Example 2
Basic usage – Open a Formula.
long iOpen = StartForm("frmformula");
Description
In this example, the Formula form for the current formula opens.
Example 3
Opening a Compare Form.
long iOpen = StartForm("FRMCOMPARE", "", "FORMULA;FS-0008\0002;SPECIFICATION;FS-0008-FOR\0002;FS-0008-PKG\0002");
Description

In this example, formula FS-0008\0002 is the base formula that is compared to these specifications:FS-0008-FOR\0002 and FS-0008-PKG\0002.

Two action sets are available in the Optiva seed database in the Lookup by Sets lookup. You can use them to open the Compare form.

You can open the form using the Verify option in the Formula toolbar.

VERIFY_FMLA_SPEC (i.e., the default).

Any specifications on the References tab of the open formula are automatically populated into the Compare List of the Compare form.

VERIFY_FMLA_PARENT

Determines whether the open formula has a parent formula. If it does, the parent is set as the base formula and the open formula as the first line in the Compare List.

If the open formula has no parent, then this action set behaves the same as the VERIFY_FMLA_SPEC action set.

Example 4
Project Management Form or Advanced Workflow Management(WIP ID).
To display the Project Management form for the Project symbol, specify the name of the object. You can also specify the name of the object and the WIP ID.
long iOpen = StartForm("FRMPROJECTMGMT", "PROJECT1");
long iOpen = StartForm("FRMPROJECTMGMT", "PROJECT1", "2237");
Description
For these examples, the name of the object isProject1 and the WIP ID is 2237.
Example 5
Display Project Management Form for any symbol other than PROJECT.
To display the Project Management Form form for a symbol other than Project, you must specify the symbol itself as the final argument. Add a semi-colon before the symbol. The WIP ID is optional.
long iOpen = StartForm("FRMPROJECTMGMT", "ITEM1", "2242;ITEM");
Description
In this example, the Project Management Form form displays the Item that is named Item 1, along with WIPID 2242.
Example 6
Display Project Management Form for any symbol other than PROJECT (Most Recent WIP ID).

To display the Project Management form for a symbol other than Project, you must specify the symbol itself as the final argument. Add a semi-colon before the symbol. The WIP ID is optional.

long iOpen = StartForm("FRMPROJECTMGMT", "ITEM1", ";ITEM");
Description
In this example, shows the most recent WIP ID, omit the WIP ID from the argument. Remember to add the semi-colon before the symbol.