Skip to content

The Purchase Request Include Screen

Key Lesson: In this step, you learn how to create an Include screen that receives Purchase Request data from a parent screen and provides reusable controls for viewing and editing request details and items.

Create the PurchaseRequestInclude screen used to display and edit Purchase Request data from other screens in the Purchasing app.

  1. In the Design area, under Object Types, select Screen. A list of default screens (Home, MainLayout, MainLayoutSidebar, MainLayoutHeader, UserProfile) appears.
  2. Click + to create a new screen.
  3. Enter PurchaseRequestInclude as the Screen ID, then click OK.

Insight

Include screens follow the naming convention as they are embedded in other screens:

  • [ScreenName]Include

For example, PurchaseRequestInclude will be embedded in screens where users work with purchase request data, such as the Purchase Request Create Screen.

  1. The screen editor opens.

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.
  1. Leave the text label Screen Purchasing.PurchaseRequestInclude in place for now. It keeps the main content area populated while you remove the default MainLayout wrapper.
  2. Save your changes before continuing.

The Include screen will be embedded inside parent screens that already use MainLayout. Remove the Include screen’s default MainLayout wrapper to prevent a second application header and sidebar from appearing inside the parent screen.

  1. Locate the Screen Purchasing.MainLayout label in the layout editor.
  2. Click the label to select the MainLayout component.
  3. Confirm that only the MainLayout component is highlighted and that none of its child components are highlighted.
  4. Right-click the selected component and select Delete & keep children.
  5. Confirm that Screen Purchasing.MainLayout is no longer displayed.
  6. Confirm that the Content Area components together with their children remain in the layout editor.
  7. Save your changes before continuing.

Tip

If you accidentally delete the wrong components, you can recover the screen:

  • If you have not saved the deletion, press F5 to reload the screen editor or close the editor without saving. Lowgile restores the last saved version of the screen.
  • If you have already saved the deletion, add a Content Area component to the blank screen and continue rebuilding the screen content.

Refreshing or closing without saving discards all changes made since the last save, including any valid unsaved changes.

The Include Screen needs access to a PurchaseRequest object passed in from the parent screen.

To enable this:

  1. Open the Variables tab (top-left of the screen editor).
  2. Click + Add new variable.
  3. Set the following properties:
PropertyValueNotes
NamerequestUsed in all bindings on this screen
ContextInputThe parent screen will pass the data into this include screen
Type
This.PurchaseRequest
Matches the entity you created earlier
Default expression(Leave blank)(Leave blank)
  1. Save your changes before continuing.

3. Display the screen variable in the VARIABLES sidebar

Section titled “3. Display the screen variable in the VARIABLES sidebar”

Switch back to the Layout tab.

  1. Expand the request variable to see its variables (e.g., costCenter, createdOn, etc.).

Editor Help

If the request variable does not appear in the Variables panel (on the right-side of the Layout tab), press F5 to refresh the editor. You might need to refresh the editor more than once.

  1. Drag request.costCenter onto the screen’s layout editor in the main content area (not the top-right content area).

Editor Help

When dragging a component or variable onto a screen, Lowgile displays a green placeholder indicating where the element can be dropped.

  1. Drop the variable onto the green area.

Attention

Make sure you drop this variable inside the screen’s main content area, not underneath the main content area.

  1. Lowgile automatically generates a dropdown for this lookup.
  2. Select the dropdown.
  3. Configure the dropdown’s properties as follows.
PropertyValueNotes
LabelCost CenterThe dropdown's label describing its function
Binding
screen.request.costCenter
Connects the UI control to the data model
  1. Leave all other properties at their default values.

  2. Save your changes before continuing.

3.2. Remove the unused content area and text label

Section titled “3.2. Remove the unused content area and text label”

Remove the unused top-right content area and the default text label before creating the screen’s outer layout.

  1. Confirm that the Cost Center dropdown is inside Content Area content.
  2. Select Content Area top-right and delete it.
  3. Confirm that Content Area content and the Cost Center dropdown remain in the layout editor.
  4. Delete the text label Screen Purchasing.PurchaseRequestInclude from Content Area content. We won’t be using it.
  5. Confirm that the Cost Center dropdown remains inside Content Area content.
  6. Save your changes before continuing.

Create a single outer layout for the include screen. This layout will contain the Cost Center layout, the purchase request items, and the Add Item layout.

  1. Wrap the dropdown in a layout in either of the following ways:

    • Right-click method:
      Select the Cost Center dropdown, right-click it, and choose Wrap with Layout.

    • Drag-and-drop method:
      Drag a layout component into the main content area, then drag the Cost Center dropdown into the layout.

  2. In the layout’s Properties panel, set the following property so the Cost Center layout, purchase request items, and Add Item layout are stacked vertically:

PropertyValue
Layoutvertical in one column
  1. Leave all other properties at their default values.

  2. Save your changes before continuing.

Editor Help

For faster editing, see the Screen Editor Shortcuts & Productivity Tools guide. It explains how to use the Insert Block dialog, wrap existing components, and streamline layout changes in the screen editor.

3.4. Wrap the Cost Center dropdown in a horizontal layout

Section titled “3.4. Wrap the Cost Center dropdown in a horizontal layout”

Controls placed directly inside a vertical layout expand to the available width. Wrap the Cost Center dropdown in a horizontal layout so that the dropdown occupies only the width it needs.

  1. Select the Cost Center dropdown inside the outer vertical layout.
  2. Wrap the dropdown in another layout using either of the methods described in the previous section.
  3. In the new layout’s Properties panel, set the following property so the Cost Center dropdown retains its natural width inside the outer vertical layout:
PropertyValue
Layouthorizontal in one row
  1. Leave all other properties at their default values.

  2. Confirm that the horizontal layout remains inside the outer vertical layout and contains only the Cost Center dropdown.

  3. Save your changes before continuing.

4. Add purchase request item functionality

Section titled “4. Add purchase request item functionality”

This section describes how to add purchase request item functionality to the PurchaseRequestInclude screen.

The outer vertical layout now contains the horizontal layout for the Cost Center dropdown. Add the Purchase Request Items underneath that horizontal layout.

In the right-hand VARIABLES panel, under screen -> request, there should be an array or list of PurchaseRequestItems called items[].

Action

If the items[] variable does not appear:

  • Press F5 to refresh the studio editor.
  • If it still does not appear, verify that the one-to-many relationship between PurchaseRequest and PurchaseRequestItem is correctly defined in the data model, including the inverse relationship. See Define Entity Relationships for details.
  1. Drag the items[] variable into the outer vertical layout.
  2. Drop it on the green placeholder underneath the horizontal layout containing the Cost Center dropdown.

Attention

Do not drop items[] inside the Cost Center’s horizontal layout. The generated For loop must be a direct child of the outer vertical layout.

  1. Lowgile will create:

    • A For Loop block
    • A Data Table
  2. Delete the table. We are using the For loop in this example.

With the For loop block selected, confirm the following properties:

PropertyValue
Array expression
screen.request.items
Loop variableitem
Loop variable type
This.PurchaseRequestItem

Insight

When a screen variable represents a one-to-many relationship, Lowgile exposes it as an array that can be rendered in different ways. Reference Screen Concepts for a conceptual overview of how arrays are rendered in screens (including the difference between Data Tables and For Loops).

4.3. Add item variables inside the For loop

Section titled “4.3. Add item variables inside the For loop”

The For loop repeats its layout once for every PurchaseRequestItem in the request.

When the For loop is selected, Lowgile exposes a loop-scoped variable named item in the Variables panel. This variable represents the current item being rendered.

As seen in the following diagram, the item variable is only visible while the For Loop is selected. It appears at the top of the Variables panel, above the screen variable.

Loop-scoped item variable versus the parent items array
  1. Select the For Loop inside the vertical layout.

  2. In the VARIABLES panel, expand the item variable.

  3. Drag the following variables from item into the for loop’s content area:

    • description
    • quantity
    • budgetAmount
    • currency
  4. Use the following tables to configure each variable’s label, type, and binding.

Attention

Ensure that all bindings reference the loop variable (item) rather than the parent screen.request.items array. Bindings that point back to screen.request.items will cause build or runtime errors.

VariableLabelTypeBinding
descriptionDescriptionText
item.description
quantityQuantityNumber
item.quantity
budgetAmountBudget AmountNumber
item.budgetAmount
currencyCurrencyBinding
item.currency
Options list sourceStatic Entity
Options list StaticEntityPurchasing.Currency
  1. Leave all other properties at their default values.

  2. Save your changes before continuing.

  1. Add a button to the outer vertical layout underneath the For Loop. Make sure the button remains outside the loop.

  2. Configure the button as follows:

ButtonTabPropertyValue
Add ItemPropertiesPrefix iconadd
TextAdd Item
AppearancePrefix iconPick an icon here if you did not already select one in the Properties tab.
ColorPrimary
Events → ClickAction type → Ad-hoc action
screen.request.items.push(new This.PurchaseRequestItem)
  1. Wrap the button in a horizontal layout. Keep the horizontal layout directly inside the outer vertical layout, underneath the For Loop.
  2. Save your changes before continuing.

This action adds a new, empty PurchaseRequestItem to screen.request.items. Because the list is rendered by a For Loop, the new item appears immediately on the screen.

5. Refine the layout and add remaining actions

Section titled “5. Refine the layout and add remaining actions”

5.1. Add a Card for each purchase request item

Section titled “5.1. Add a Card for each purchase request item”

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

  1. In the LAYOUT section of the Components toolbar section of the component toolbar, select the Card component.
  2. Drag the Card into the For loop, placing it at the top of the loop’s content area.
  3. Save your changes before continuing.

Each iteration of the For Loop now renders its own Card.

Give each Card a dynamic title so users can distinguish between multiple purchase request items.

  1. Select the Card.
  2. Configure the title as follows:
PropertyModeValueNotes
TitleExpression
`Item ${itemIndex + 1}`
Click the T icon to switch the property to expression mode. The icon changes to E.
  1. Save your changes before continuing.

  1. Before dragging the 4 item variables inside the card, add another layout inside the card.
  2. In the layout’s Properties panel, set the following property:
PropertyValueNotes
Layoutgrid with fixed columnsArranges item fields into a structured grid so each purchase request item is compact, readable, and visually consistent
Number of columns2Leave as the default for now
  1. Drag the 4 item variables inside this layout.
  2. Save your changes before continuing.

Add a Remove Action (button so users can delete purchase request items they no longer need.

  1. Select the Card.
  2. In the Properties panel, locate Action text.
Location of the Action text property in the Card properties
  1. Enter Remove in the Action text property.

  2. Click Move to Content Area, then click OK.

A new content area is added to the Card.

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:

ButtonTabPropertyValue
RemovePropertiesPrefix icondelete
TextRemove
AppearanceColorWarn
Events → ClickAction type → Ad-hoc action
screen.request.items.splice(itemIndex, 1)
  1. Save your changes before continuing.

5.4. Hide the Add Item and Remove buttons when the screen is disabled

Section titled “5.4. Hide the Add Item and Remove buttons when the screen is disabled”

Hide the Add Item and Remove buttons when the include screen is used in read-only mode.

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 each button.
  2. Drag the button inside the If component.
  3. Configure the If component as follows:
PropertyValue
Condition
!$disabled
  1. Save your changes before continuing.

Understand screen variables, component bindings, and how screens share data.

Learn how For components and data tables render collections of related records.

Review the logic components used to control visibility and interaction states.