A virtual is a projection construct that behaves like an Entity but is not backed by a real database table or LU API. Virtuals exist only in memory for the duration of a user interaction — they’re the standard way to model the data for dialogs, assistants, and multi-step wizards.
Because virtuals have no underlying table, they cannot use from or inherit CRUD from an LU. All persistence logic is handled explicitly in actions attached to the virtual or called from client commands.
Virtuals can be nested — a parent virtual can have an array child relationship to another virtual. This models the parent/detail pattern inside dialogs (e.g., a header with a list of line items to distribute quantities across).
-- The entityset exposes the parent virtual to the cliententityset AdjustOperationSplitSet for AdjustOperationSplitVirtual;-- Parent virtual: holds header-level data for the dialogvirtual AdjustOperationSplitVirtual { -- ludependencies: after the action, refresh ShopOrd and ShopOrderOperation in the client ludependencies = AdjustOpInSplitVirtual; attribute OrderNo Text { editable = [false]; -- display-only; populated by input parameters } attribute ReleaseNo Text { editable = [false]; } attribute SequenceNo Text { editable = [false]; } attribute TotalQty Number { label = "Total Qty to Adjust"; editable = [false]; } attribute RemainingQty Number { label = "Remaining Qty to Adjust"; editable = [false]; } attribute UnitMeas Text; -- Array child: each element is an AdjustOpInSplitVirtual row -- Parentheses can hold key parameters to scope the child query array AdjustSplitOpArray() to AdjustOpInSplitVirtual(); -- Inline action: user clicks "OK" in the dialog to trigger this action AdjustSplitQuantities { supportwarnings = [true]; ludependencies = ShopOrd, ShopOrderOperation; }}-- Child virtual: one row per operation split linevirtual AdjustOpInSplitVirtual { crud = Read, Update; -- lines can be read and edited, not created/deleted attribute Contract Text { label = "Site"; editable = [false]; } attribute OperationNo Number { label = "Operation No"; editable = [false]; } -- Inline validation: prevents negative quantities attribute QtyToDistribute Number { label = "New Qty to Report"; editable = [true]; validate [QtyToDistribute >= 0] message "Negative values are not allowed"; } attribute QtyScrapped Number { label = "Scrapped Qty"; editable = [false]; } -- Enumeration attribute: value maps to an enumeration definition attribute OperStatusCode Enumeration(OperStatusCode) { label = "Status"; editable = [false]; } attribute WorkCenterNo Text { label = "Work Center"; editable = [false]; } reference WorkCenterNoRef(Contract, WorkCenterNo) to WorkCenter(Contract, WorkCenterNo) { label = "Work Center"; }}
Example — Virtual for a Scheduled Task Assistant
Source: ifs-example/shpord/model/shpord/AggregateShopOrderCostsperShopOrderHandling.projection (inferred from client)
-- Virtuals for assistants follow the same patternentityset TaskVirtuals for TaskVirtual;virtual TaskVirtual { -- Holds scheduling parameters and execution state attribute ScheduleMethodId Number; attribute ScheduleName Text { label = "Task Name"; } attribute TaskOption Text; attribute Site Text; attribute Result Text { editable = [false]; } -- Params is a structure returned by GetParameters() function attribute Params Structure(ScheduleTaskParameters);}
Patterns & Tips
Virtual + Structure vs. Virtual + Virtual
Use a Structure when you need to pass a fixed set of parameters to an action or function (like function return values). Use a child virtual when you need a list of editable rows inside a dialog (like quantity distribution lines). Structures can’t be listed; virtuals can.
Always Declare crud on Child Virtuals
Without a crud declaration on a child virtual, the framework defaults to allowing all operations, including Delete. Dialog line rows are rarely deletable — explicitly set crud = Read, Update to prevent the user from deleting lines they shouldn’t be able to delete.
Virtuals Don't Persist — Actions Must Do the Work
A virtual has no Save button behavior by default. Data entered in a virtual dialog only reaches the database when an Action is called (typically from the dialog’s OK command). If you forget to wire up the action, user input is silently discarded.
validate on Virtual Attributes Is Server-Validated
The validate [condition] message "..." syntax on virtual attributes is enforced server-side when the record is saved. It’s different from client-side enabled or editable conditions — the user can attempt to save but will get an error message if validation fails.
See Also
Entity — for database-backed, persistent data constructs
Structure — for fixed parameter bags passed to actions/functions
Entityset — wraps the virtual to expose it to a client page
Action — the server-side logic triggered by dialog OK/Apply
Dialog — the client UI construct that uses a virtual
Assistant — multi-step UI wizard that uses a virtual