🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
WECPOF Goodies
This page was created by Alexandra on 2018-11-06. Last edited by Wikiadmin on 2026-07-29.

You can make WECPOF search results easier to understand, add rows directly from a grid, and define default workspace content when you prototype WECPOF ViewModels.

Search-expression column highlighting

Use column highlighting when a Seeker has multiple search expressions and each expression primarily searches a different result column. WECPOF can then show the user which column corresponds to the search expression currently in effect.

Configure the Eco.HiliteGridColumn tagged value on each SearchExpression. Its value must identify both:

  • the ViewModel class that supplies the search-result grid; and
  • the column to highlight for that SearchExpression.

Use this format:

ViewModelClassName.ColumnName

For example, if SearchResultGrid is the ViewModel class for the result grid and it has columns named Efternamn and Förnamn:

SearchExpression Tagged value Value
SearchExpression Eco.HiliteGridColumn SearchResultGrid.Efternamn
SearchExpression2 Eco.HiliteGridColumn SearchResultGrid.Förnamn

When the user searches, WECPOF highlights the configured column for the expression it uses. If the user moves to another search expression, the highlight changes to that expression's configured column.

This makes multi-expression search behavior visible. For example, a person seeker can show that the current input is being interpreted as a last-name search by highlighting Efternamn, rather than leaving the user to infer the search rule from the returned rows.

Configure the highlight

  1. Identify the ViewModel class that renders the seeker result grid.
  2. Identify the exact ViewModel column name that represents the field searched by each SearchExpression.
  3. Add Eco.HiliteGridColumn to each relevant SearchExpression.
  4. Set the value to ViewModelClassName.ColumnName.
  5. Run the ViewModel in WECPOF and test each search expression to confirm that the intended result column is highlighted.

GridAction: create an object from the last grid row

A GridAction lets the user enter a value in a dedicated row at the bottom of a grid. When the user submits that value, WECPOF stores it in vGridActionArgument and executes an Action. Use it when creating an object normally requires the user to click an action, navigate to the new row, and then edit its first value.

For example, instead of requiring the user to select Create Class1 and then find the newly created Class1 row, you can provide a final entry row where the user types the value for Attribute1.

How a GridAction works

  1. Add an Action to the Nesting in the ViewModel that the grid displays.
  2. WECPOF adds a null row at the bottom of the grid for that Action.
  3. WECPOF displays the Action name in italics in the null row, distinguishing it from rows that represent existing objects.
  4. The user enters text in the GridAction row and submits the edit, for example by pressing Enter.
  5. WECPOF assigns the entered text to the ViewModel context variable vGridActionArgument.
  6. WECPOF executes the configured Action.

The Action must use vGridActionArgument to create or update the appropriate object.

Example: create a top-level object

For a grid of Class1 objects, an Action named GridAction_NewClass1 can create an object and copy the entered value to Attribute1:

let x=Class1.Create in
(
  x.Attribute1:=vGridActionArgument
)

If the user enters Example value in the italic GridAction row and submits it, the Action creates a Class1 object whose Attribute1 is Example value.

Example: create a detail object for the current master

A GridAction in a detail grid can assign the new object to the current master. If a Class2 grid is a detail of the current Class1, use the current context when creating the detail object:

let x=Class2.Create in
(
  x.Name:=vGridActionArgument;
  x.Class1:=vCurrent_AllInstances
)

Here, the entered text becomes the new Class2.Name, and x.Class1:=vCurrent_AllInstances associates the new Class2 with the current Class1 master.

Design guidance

Situation GridAction design
The grid represents objects that can be named from one text value Create the object and assign vGridActionArgument to its name or primary entry attribute.
The grid is a detail of a selected master object Create the detail object, assign vGridActionArgument, and associate it with vCurrent_AllInstances.
The entered value should identify an existing object Use the GridAction to open a Seeker and use the entered value as its search input.

GridAction with a Seeker

You can combine a GridAction with a multi-variable Seeker so the user can search for an existing object and add it in one flow. This is useful when, for example, a user adds a tenant to a house: the user enters a person name in the grid's final row, and the Action opens a Person Seeker.

In this pattern, the GridAction Action opens the Seeker. The Action's OnShow expression sets the vSeekParam filter from the entered GridAction value.

The runtime flow is:

  1. The user enters a value in the GridAction row and submits it.
  2. WECPOF assigns the value to vGridActionArgument and runs the GridAction.
  3. The GridAction opens the Person Seeker.
  4. The Seeker's OnShow expression sets vSeekParam from the entered value.
  5. WECPOF detects that the opened ViewModel is a Seeker and starts the search.
  6. If the search has exactly one result, WECPOF executes the Seeker's After Modal Ok expression. The Seeker closes and the Action assigns that person as the tenant.
  7. If the search returns no results or more than one result, the Seeker remains open so the user can enter or select different criteria.

The exact-one-result condition is important. Do not rely on this flow to choose among multiple matches: when there are two matching people, the Seeker stays open rather than assigning either person automatically.

Special ViewModel names

WECPOF recognizes two ViewModel names as workspace-level content. Name these ViewModels exactly as shown.

ViewModel name Where WECPOF shows it Typical use
DropTargetViewModel On the WECPOF screen Persistent information or a scratchpad where users can drag objects.
DefaultBackgroundViewModel In the workspace when no tabs are open Start-page navigation, a system-administrator message, or a list of objects with broken constraints.

Use DropTargetViewModel for content that should remain available while users work. Use DefaultBackgroundViewModel for content that should appear only when no ViewModel tabs are open.

See also