Skip to Content

Target in Business Object Rules

When you are creating Rules in the Business Object Layer of Vinyl, there are instances where you want a Column being used by the Rule to Target a selected Column from the Data Layer, and instances where you don't need or want to define a Target. Target specifies what Column data will be saved to, if it gets saved. Anytime you want Column data to get saved back to a Table, you need to define a Target. If you are not intending to write any data back to the field for a given Column, you do not need to set a Target value.

For the purpose of this article, "Target" refers to the Column in the targeted table that the Column or Expression is impacting or able to write data back to. Any given Rule created in Vinyl has one defined Target Table. A Target Table is the named table that is being defined as editable by the Application UI Layer. A Rule can of course have multiple Tables used by it, but only one Table can be set as the Target Table.

When Target information is being defined for the Columns Panel in the Business SQL, that is referring to the specific location where data will be saved for that Column or Expression (if it gets saved). Rules can have mixed usage for Target, where some Columns have Target defined and some do not.

Business Object Rule Examples

Rule with all Columns Set to Target

When we create a Source Business Object, this is an example where we want every Column being used in the Rule to be set to Target its corresponding Column from the Data Layer. The Source Business Object is essentially a copy of exactly how the underlying table looks at the Data Layer and should contain all Columns the Table has available to it. The Columns being displayed for Source Business Objects should map to their corresponding same Target Columns from the table.

Rule with some Columns Set to Target

In the following scenario, you might have a Business Object Rule defined for the Employee table, where the Columns added to the Rule include the Primary Key, Last Name, First Name, and a Concat function used to derive the Employee Full Name. For these Columns, all will Target their corresponding Column value from the Target table except for the Concat function column. The Concat Column will have no Target set, as it is not intended to modify any of the existing underlying Columns from the Target table. We will use the Concat Column for display purposes only in the Application UI Layer.

Rule with no Columns Set to Target

When you're creating Rules where their purpose is to display information only, and not save it back to any Column in a Table, then you do not need to set Target values for Columns and/or Expressions used in the Rule.

Subqueries are typically an example Rule that does not set Target information. Generally speaking Subqueries in Vinyl represent a combination of different tables that give you a derived set of information to be displayed only or to be used by another Rule. Subqueries typically do not need to save back to a table.