2022 June 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

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 Page: Expression for Computing the Visibility

This option defines a Fabasoft app.ducx expression that computes the visibility of a form page (see also COOATTREDIT@1.1:formpagevisibleexpr). 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).

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). 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).

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).

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).

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]);

More information on the selection operator [] can be found here:

https://help.appducx.fabasoft.com/index.php?topic=doc/An-Introduction-to-Fabasoft-appducx/operators.htm#selection-operator

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).

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 if 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).

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).

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).

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).

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;

Compute Control Styles

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

The possible settings for each control can be found here: https://help.appducx.fabasoft.com/index.php?topic=doc/Reference-Documentation/controls-overview.htm

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).

The possible settings for each control can be found here: https://help.appducx.fabasoft.com/index.php?topic=doc/Reference-Documentation/controls-overview.htm

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;