Skip to content

Refine the Purchase Request Include Screen

Key Lesson: Refine a repeated Screen layout with a Card for each item, use the For Loop index in a dynamic title, and conditionally expose editing actions.

Refine the existing PurchaseRequestInclude Screen without changing its input variable, Cost Center control, item bindings, or Add Item action. This stage adds the presentation and editing behavior needed by the finished sample application.

Before continuing, confirm that the Screen contains the For Loop, the four item controls, and the Add Item button created in Purchase Request Include Screen.

  1. In Design, under Object Types, select Screen.
  2. Open PurchaseRequestInclude.
  3. Select the Layout tab.
  4. Locate the For Loop that renders screen.request.items.

Editor Help

To visually identify screen areas, make sure the app is running. Hold Ctrl+Alt (Windows) or Ctrl+Option (macOS), then move your cursor over the UI. Lowgile highlights the screen responsible for each section. This is useful when debugging layouts.

Use a Card to group the controls for each PurchaseRequestItem into a separate visual container.

  1. In the LAYOUT section of the Components toolbar section of the component toolbar, select Card.
  2. Drag the Card into the For Loop and place it at the top of the loop’s content area.
  3. Select the Card and configure its title:
PropertyModeValueNotes
TitleExpression
`Item ${itemIndex + 1}`
Select the T icon to switch the property to expression mode. The icon changes to E.
  1. Save your changes before continuing.

Each For Loop iteration now renders its own Card. The zero-based itemIndex is increased by one so the visible titles begin with Item 1.

  1. Add a Layout inside the Card.
  2. Configure the Layout as follows:
PropertyValuePurpose
Layoutgrid with fixed columnsArranges the item controls in a structured grid.
Number of columns2Places the four item controls in two columns.
  1. Move the existing Description, Quantity, Budget Amount, and Currency controls into this Layout.
  2. Confirm that the Card and its Layout remain inside the For Loop.
  3. Save your changes before continuing.

If this does not happen:

If an item control stops displaying or updating its value, confirm that it remains bound to the loop-scoped item variable. Do not bind a control to the full screen.request.items collection.

Create a Card action area and replace its generated text with a button that removes the current item.

  1. Select the Card.
  2. In Properties, locate Action text.
Action text property in the Card properties
  1. Enter Remove in Action text.
  2. Select Move to Content Area, then select OK.
Content area created from the Card action text
  1. Delete the generated Remove Text component.
  2. Add a Button in its place.
  3. Configure the button as follows:
TabPropertyValue
PropertiesPrefix icondelete
PropertiesTextRemove
AppearanceColorWarn
Events → ClickAction type → Ad-hoc action
screen.request.items.splice(itemIndex, 1)
  1. Save your changes before continuing.

The itemIndex supplied by the For Loop identifies the item removed from screen.request.items.

5. Hide editing actions in a disabled context

Section titled “5. Hide editing actions in a disabled context”

Keep the Include Screen editable by default. When a parent Screen places it in a disabled context, hide the actions that change the item collection.

Complete these steps for both the Add Item and Remove buttons:

  1. In the LOGIC section of the Components toolbar section of the component toolbar, add an If component next to the button.
  2. Move the button inside the If component.
  3. Set the Condition property to:
PropertyValue
Condition
!$disabled
  1. Save your changes before continuing.

$disabled is supplied by the surrounding Screen context. The !$disabled condition displays the editing action only when that context is not disabled.

Test only the behavior introduced in Refine the Purchase Request Include Screen. Use distinct temporary values so that each item remains easy to identify.

  1. Wait until the Purchasing application name is green.
  2. Open the application.
  3. In the application sidebar, expand Purchase Request.
  4. Select Create New.
Expected result:

The Create Purchase Request Screen opens and displays the Add Item action.

If this does not happen:

If the Screen does not open, return to Verify the first Screens and navigation and resolve the application build, navigation, or embedding issue before testing these refinements.

  1. Select Add Item twice.
  2. Enter different values in the two item Cards.
  3. Compare the Card titles and controls.
Expected result:

Two independently editable Cards appear. Their titles are Item 1 and Item 2, and each Card presents Description, Quantity, Budget Amount, and Currency in a two-column layout.

If this does not happen:
  • If adding another item changes the first item, confirm that every control is bound to the loop-scoped item variable.
  • If a title does not evaluate, select the Card, switch Title to expression mode (E), and enter `Item ${itemIndex + 1}` with the surrounding backticks.
  • If both Cards do not appear, confirm that Add Item runs screen.request.items.push(new This.PurchaseRequestItem) and that the For Loop renders screen.request.items.
  1. Select Remove on the first Card.
  2. Confirm that the Card containing the first item’s test values is removed.
  3. Confirm that the remaining Card still contains the second item’s values.
  4. Observe the remaining Card title.
Expected result:

Only the selected item is removed. The remaining item keeps its values and its dynamic title updates to Item 1 based on its current For Loop index.

If this does not happen:

Confirm that the Remove button is inside the Card generated by the For Loop and that its action is screen.request.items.splice(itemIndex, 1). If the wrong Card is removed, confirm that the action uses the loop-scoped itemIndex without a fixed number.

4. Verify disabled-state control configuration

Section titled “4. Verify disabled-state control configuration”

The active application Screen is editable at this stage. Verify the configuration that later hides collection-editing controls when a parent Screen supplies a disabled context.

  1. Return to Lowgile Studio and open PurchaseRequestInclude.
  2. Select the If component that contains Add Item.
  3. Confirm that its Condition is !$disabled.
  4. Select the If component that contains Remove.
  5. Confirm that its Condition is !$disabled.
Expected result:

Both editing buttons are nested in separate If components with the condition !$disabled. The controls are therefore available in the current editable Screen and hidden when a parent Screen supplies a disabled context.

If this does not happen:

If either action remains outside its If component or uses a different condition, return to Hide editing actions in a disabled context and correct the component placement or expression. Live parent-disabled behavior is tested later when the Include Screen is embedded in the Approve Request Screen.

Use this checklist before setting up data storage, access, and shared application state.