2024 December Release

FormsPermanent link for this heading

In the graphical form editor, you can easily create new forms using drag-and-drop and extend objects with application-specific properties without requiring any programming knowledge. You can either add a form to an existing object (shown in the properties of the object), or you can directly create objects based on a form.

Useful for Following Tasks

  • Objects and documents with customized data fields should be available.
  • Rooms with customized data fields should be available (behave like Teamrooms).
  • Containers with customized data fields should be available (may also be defined as file).
  • Existing objects should be extended by customized data fields.
  • Charts based on user-defined compound types should be available.

Essential information about forms can be found in the user help:

https://help.cloud.fabasoft.com/index.php?topic=doc/User-Help-Fabasoft-Cloud-eng/advanced-use-cases.htm#forms: new window

ScenarioPermanent link for this heading

Objective

The “Development” department needs to structure their technical documents based on their own classification scheme. The following metadata should be available:

  • Manufacturer
  • Product
  • Information Type (“User Manual”, “Service Manual”, “Specification”)
  • Availability (“Internal”, “External”; read-only field based on the information type; not visible if no information type is defined)

To achieve the objective, proceed as follows:

  • Navigate to “Templates and Presettings” > “Form and Category Collections” > “Your desired form collection”.
  • Create a new form.
  • Use the Suppress Template Creation option, to prevent objects from being created based on the form. The form should only be applied to existing documents.
  • Manufacturer and Product can be defined as input fields of type string.
  • The Information Type can be defined as a combo box with the required three values. The Programming Name is defined as “informationtype”. Add the following expression so that the availability is directly refreshed when the information type is changed:
    • Handle Changes of Values > Expression for Handling Changes of Values
      true;
  • The Availability can be defined as combo box with the required two values. To apply the required logic, add the following expressions (see the next chapter for a description):
    • Compute Visibility of Field > Expression for Computing the Visibility
      cooobj.availability;
    • Compute Value of Field > Expression for Computing the Value
      switch (cooobj.informationtype) {
        
      case 1:
        
      case 2:
          @availability = 2;

          
      break;
        
      case 3:
          @availability = 1;

          
      break;
      }

      @availability;
  • The form can be added to existing documents by assigning the corresponding Category (Published) to the documents (“General” tab > Category). The category can also be used to define additional settings (see chapter “Categories”).
    Note: The settings of the Category (Draft) are applied to the Category (Published) when the form is (re-)released.

Objective

The “Sales” department needs to compare the profit with the projected profit for each sales region. In addition, a chart is needed to visualize the number of contracts based on their states.

To achieve the objective, proceed as follows:

Visualize the Profit for Each Sales Region

  • Navigate to “Templates and Presettings” > “Form and Category Collections” > “Your desired form collection”.
  • Create a new form with “Compound Type” as Base Class, and define three input fields:
    • Sales Region (Type: “String”)
    • Projected Profit (Type: “Float”)
    • Profit (Type: “Float”)
  • Create a new form with “Compound Type” as Base Class, and define two item lists:
    • Values (Type: “Compound Type”, Compound Type User Form: the previously defined compound type, Compound Type Display Mode: “Standard”, Programming Name: “plainvalues”)
    • Chart (Type: “Compound Type”, Compound Type User Form: the previously defined compound type, Compound Type Display Mode: “Chart”, Expression for Computing the Value: value = cooobj.plainvalues, Expression for Calculating the Control Options: dictionary({ chart: { type: "bar" } });)
      The values for the chart are taken from the Values field using the expression for computing the value. The chart should be a bar chart.

Visualize Contracts Based on Their State

  • Navigate to “Templates and Presettings” > “Form and Category Collections” > “Your desired form collection”.
  • It is assumed that there are contracts defined as form (“Contract”) with a State combo box (Programming Name: “contractstate”) defining three states.
  • Create a new form with “Compound Type” as Base Class. The compound type will be assigned to a property on the second form. Define two input fields:
    • State (Type: “String”, Programming Name: “ctstate”)
    • Amount (Type: “Integer”, Programming Name: “ctamount”)
  • Create a new form and define two item lists:
    • Contracts (Type: “Object”, Default Form for Objects in Field: “Contract”, Programming Name: “contracts”)
    • Chart (Type: “Compound Type”, Compound Type User Form: the previously defined compound type, Compound Type Display Mode: “Chart”, Expression for Calculating the Control Options: dictionary({ chart: { type: "pie" } });)
      Expression for Computing the Value:
      Object[] @contracts = cooobj.contracts;
      value = [

        {

          ctstate = "In Progress",

          ctamount = count(@contracts[contractstate == 1])

        },

        {

          ctstate = "Review",

          ctamount = count(@contracts[contractstate == 2])

        },

        {

          ctstate = "Approved",

          ctamount = count(@contracts[contractstate == 3])

        }

      ];

      The values for the chart are taken from the Contracts field using the expression for computing the value. The chart should be a pie chart.

Using Fabasoft app.ducx ExpressionsPermanent link for this heading

To apply some logic or dynamic behavior to the fields, Fabasoft app.ducx expressions can be used.

When you hover over a user-defined field in the form editor, the “Edit” button is displayed. Click it to edit the field, then click the “Advanced” or “Display” tab. Here you can enter the desired Fabasoft app.ducx expression logic.

The following expressions can be defined in the context of forms:

Form: Prepare Commit Configuration

Defines an app.ducx expression that is called when the object is prepared for the commit of the transaction (see also FSCUSERFORMS@1.1001:pccgexpr: new window).

Form Page: Compute Visibility of Page

Defines a Fabasoft app.ducx expression that computes the visibility of a form page (see also COOATTREDIT@1.1:formpagevisibleexpr: new window). Click the “Edit” button of the form page itself, then define the desired expression.

Example

// the page is not shown in explore mode (widget in the content area)
::context != #COODESK@1.1:ExploreObject;

Compute Visibility of Field

Defines a Fabasoft app.ducx expression that computes the visibility of a property (see also COOSYSTEM@1.1:attrvisibleexpr: new window).

Note: Specified field widths are always considered. This can result in gaps if several fields are defined in a line and one or more of them are hidden by visible expressions.

Example

// the field is only shown if it contains a value
// may be useful if it is
a programmatically set read-only field
cooobj.informationtype;

Compute Value of Field

Defines a Fabasoft app.ducx expression that computes the value of a property (see also COOSYSTEM@1.1:attrvalueexpr: new window). A property with a Fabasoft app.ducx expression for computing its value is always displayed as read-only in the user interface.

Example

// FSCUSERFORMS@1.1001:GetFieldValue is used to read the the index of
//
the combo box with programming name "informationtype"
//
the index of the current combo box is set to 2 or 1 depending on the
// value of the combo box "informationtype"

switch(cooobj.informationtype) {
  
case 1: // user manual
  
case 2: // service manual
    @availability = 2;
// external
    
break;
  
case 3: // specification
    @availability = 1;
// internal
    
break;
}

@availability;
// return value

Handle Initialization of Field

Defines a Fabasoft app.ducx expression that computes the initialization value of a property (see also COOSYSTEM@1.1:attrinitexpr: new window).

Example

// object property: when creating an object the initial value will be an
// object with ID COO.1.506.3.4876

COO.1.506.3.4876

Compute Changeability of Field

Defines a Fabasoft app.ducx expression that computes the changeability of a property (see also COOSYSTEM@1.1:attrchangeableexpr: new window).

Example

// the field can only be edited when the object is created
cootx.IsCreated(cooobj);

Filter Values

Defines a Fabasoft app.ducx expression that specifies the selectable values of a property (see also COOSYSTEM@1.1:attrfilterexpr: new window).

Example

// it is assumed that there is an object list with programming
// name "contractdocs"

// the following filter is assigned to a
n object property "maindoc"
//
only objects contained in "contractdocs" with category
// COO.1.506.3.4201 are provided for selection in "maindoc"
OBJECTLIST(contractdocs[COOTC@1.1001:objcategory == COO.1.506.3.4201]);

Filter Values Within Search

Defines a Fabasoft app.ducx expression that specifies the selectable values of a property in context of a search (see also COOSYSTEM@1.1:attrsearchfilterexpr: new window).

Handle Changes of Values

Defines a Fabasoft app.ducx expression that handles the change of a value of a property in the user interface (see also COOSYSTEM@1.1:attruichangeexpr: new window).

Example

// the integer property "days" is set, if the date properties change and
// the conditions are met (must contain values, enddate >= startdate)

// the following expression is assigned to the date properties

//
"startdate" and "enddate"
if (cooobj.startdate && cooobj.enddate) {
  if (cooobj.enddate >= cooobj.startdate) {
    cooobj.days = (cooobj.enddate - cooobj.startdate) / 86400;
  }
}

Compute Whether the Property Must Be Defined

Defines a Fabasoft app.ducx expression that computes whether the property must contain a value (see also COOSYSTEM@1.1:attrmustbedefexpr: new window).

Example

// it is assumed that there is an integer property "importance"
// the following expression is assigned t
o a property "approvedby"
// if the
importance value exceeds 10000 "approvedby" is mandatory
cooobj.importance > 10000;

Validate Value

Defines a Fabasoft app.ducx expression that validates a changed value of a property in the user interface (see also COOSYSTEM@1.1:attrvalidateexpr: new window).

Example

// if the value of the float property is lower than 0, an error is shown
::value >= 0;

Handle Reading of Field

Defines a Fabasoft app.ducx expression that is called before the value of the property is read (see also FSCUSERFORMS@1.1001:attrgetexpr: new window).

Handle Saving of Field

Defines a Fabasoft app.ducx expression that is called before saving the value of the property when committing a transaction (see also FSCUSERFORMS@1.1001:attrsetexpr: new window).

Example

// it is assumed that there is an object property "maindoc"
// the following expression is assigned to a property "approvedby"

// the subject of the document in "maindoc" will be set to the value of

// "approvedby"

cooobj.maindoc.ObjectLock(true, true);

cooobj.maindoc.objsubject = value;

Read Display String

Defines an app.ducx expression that is called when a string representation of the value of the property is needed (see also FSCUSERFORMS@1.1001:attrgetdispexpr: new window).

Handle Copying of Field

Defines an app.ducx expression that is called when the property is copied (see also FSCUSERFORMS@1.1001:attrcopyexpr: new window). See also the execution order at the end of this chapter.

Handle Construction of Field

Defines an app.ducx expression that is called when the property is created (see also FSCUSERFORMS@1.1001:attrctorexpr: new window). If you just want to set the initial value of the property use Handle Initialization of Field. Handle Construction of Field can be used to run more general code.

Note: If you use the construction of the field to define an initial value, you may also want to define COOSYSTEM@1.1:NoOperation as copy action to keep the initial value for the copied object (see also the execution order at the end of this chapter).

Handle Destruction of Field

Defines an app.ducx expression that is called when the property is deleted (see also FSCUSERFORMS@1.1001:attrdtorexpr: new window).

Compute Control Styles

Defines an app.ducx expression that computes the control styles used to display the property (see also COOSYSTEM@1.1:attrcontrolstyleexpr: new window).

Example

// disables the create and search button for an object property
[COOATTREDIT@1.1:ControlStyle(CTRLSTYLE_DISABLECREATE),
COOATTREDIT@1.1:ControlStyle(CTRLSTYLE_DISABLESEARCH)]

Compute Control Options

Defines an app.ducx expression that computes the control options used to display the property (see also COOSYSTEM@1.1:attrcontroloptionsexpr: new window).

Example

// the control options are applied to a multiline text property of
// type HTML only the basic styles toolbar is displayed and the height

// is fixed to 10 em

dictionary dict = {
  toolbarGroups:
"basicstyles",
  height:
"10em"
};

return
dict;

Execution Order

If you define the following expressions, the execution order will be as follows (e.g. when creating an object based on the form):

  1. Handle Construction of Field
  2. Handle Copying of Field
  3. Handle Initialization of Field
  4. Prepare Commit Configuration
  5. Handle Saving of Field

Note: The expressions can also influence the draft and release templates of the form, because also in this case construction, initialization and copy expressions are evaluated.