Overview
This article describes the following elements:
What is a component?
A component is a special group that contains re-usable logic. It can contain variables, constants, operators, links, and even other groups. The outermost group that encapsulates all of the logic is considered the scope of the component.
The main purpose of components is re-usability, with the following benefits:
Eliminates redundancy
Reduces maintenance time
Speeds up model design
A few examples:
Component Name: "COGS"
Description: Calculation for COGS as a % of Revenue
Component Name: "Headcount_By_Dept"
Description: Calculation for Salary/Wages, Benefits, Payroll Taxes and Total Payroll Expenses as a function of several inputs.
How is a component used in a Logica model?
Components are designed for re-usability. Within a given model, a single component can be cloned to create multiple components that all have the same logic. Unlike standard copy/paste, the clones can be updated at any time, as they are all synced with each other. A component can also be used as a standalone calculation in a model.
Adding components from the Template Library
Adding components to a model from the Logica Template Library is done from the canvas. From any view, show the canvas and locate the destination group that will contain the new component. Right-click on the group, then "Insert component", then select the desired component. The newly created component is a copy of the template and can be changed and customized as needed without affecting the original component template.
Inserting new component clones
Inserting new component clones from the table
After the first component leader has been set up, Editors can insert new clones using this button in the Table header. Contributors can also add new clones using this button if enabled for a given view.
Multiple clones can be added once by updating the desired amount when prompted by Logica.
Allowing Contributors to insert new component clones from the table
Editors can allow Contributors to insert new clones from the table of a given view. This feature allows Contributors to perform more actions without needing to be granted full Editor access.
To enable this, click on the gear icon to open "Table Settings" and select "Allow contributors to insert new clones" within the Advanced options section. This setting is off by default for new views.
Note that this setting is applied uniquely to each view, and only allows inserting clones for components that are pinned to that view. For example, let's say a Contributor has access to two different views, and both of those views have a Headcount component pinned. If View 1 has this setting enabled and View 2 has this setting disabled, the Contributor will only be able to insert a new Headcount from View 1.
Inserting new component clones from the canvas
Editors can also insert new clones directly from the canvas. Right-click on the component group name in the canvas, then click "Insert clone".
Multiple clones can be added once by updating the desired amount when prompted by Logica.
Updating component clones
A valuable feature enabled by creating component clones is that they can all be updated at once. For example, let's say a model has 200 clones of a headcount component and a change is needed in the logic for all of them. The change can be applied by editing the leader component in the canvas and all of the clones are synced automatically.
Deleting component clones
Deletion of components can be done from the table or the canvas. Once a component is deleted, it cannot be undone.
Deleting component clones from the table
Editors are able to delete individual clones from the table. To delete from the table context menu, right-click the specific component clone row and select "Delete selected...".
Deleting component clones from the canvas
Editors can delete all clones, and this action can only be done from the canvas. To delete from the canvas, first locate the specific component in the canvas. Next, right-click on the entire component group (not just a specific node inside of the component), and select "Delete all followers".
What's next?
Begin building arithmetic formulas, which will be the foundation for your models.
Learn about the more complex operators in Logica--comparison and conditional operators.