2017 June Release

Defining and extending component object instancesPermanent link for this heading

Defining a new component object instancePermanent link for this heading

Using the instance keyword, you can define instances of component objects that become part of your software component. You can only define instances of object classes that are either directly or indirectly derived from COOSYSTEM@1.1:ComponentObject.

The instance keyword must be followed by the object class of which an instance should be created, and by the reference of the new instance. You can use generic assignment statements inside the instance block to assign values to the properties of the instance.

Syntax

instance objectclass reference {
  ...
}


For maintaining a well-organized project structure, it is recommended that you create a separate .ducx-om file for defining instances of component objects although – from a syntactic point of view – you could define all object model-related elements within a single .ducx-om file.

Cloud profile note: Only component objects can be instantiated.

Example

objmodel APPDUCXSAMPLE@200.200
{
  import COOSYSTEM@1.1;
  import FSCFOLIO@1.1001;
  import COOTC@1.1001;
  import COOAR@1.1;
  import FSCCHE@1.1;

  // Definition and initialization of a document category
  instance ComponentDocumentCategory DocumentCategoryOrder {
    dcshortform = "Order";
    categorycommon = false;
  }

  // Definition and initialization of an active report
  
instance ActiveReport_Web CaseReport {
    content = file("resources/test.txt");
    transform<transapp, transpassive, transencoding, transactive,
      transembplain<textembbeg, textembend>> = {
      { APP_NONE, FORMAT_TXT, windows1252, "JavaScript", { { "<%", "%>" } } }
    }
  }
}

Extending an existing component object instancePermanent link for this heading

Syntax

extend instance <reference> {
  ...
}


Using the extend instance keywords, it is possible to extend an existing component object.

The extend instance keywords must be followed by the reference of the component object to be extended. You can use generic assignment statements inside the extend instance block to assign values to the properties of the instance.

Cloud profile note: For instance extensions several restrictions apply. For a detailed overview, please refer to chapter “Object Model Language”.

Example

objmodel APPDUCXSAMPLE@200.200
{
  import COOSYSTEM@1.1;

  // Exclude order and invoice objects from the list of objects allowed
  // on the user's desk

  extend instance objchildren {
    attrnotallowed<attrallclass, attrallcomponent> = {
      { Order, APPDUCXSAMPLE@200.200 },
      { Invoice, APPDUCXSAMPLE@200.200 }
    }
  }
}