Usina BRAdvPL Guide
Sign in
← All topics
PRACTICAL GUIDEUnder review

MVC grid operations

oGrid:SetValue(cId,xValue) -> lOk

Changes values through the grid submodel API.

MVC grid operationsAdvPL
01 · OVERVIEW

Overview

FWFormGridModel maintains rows, validation and model state. SetValue(cId,xValue) operates on the current row and returns logical; GetValue(cId,nLine) can read a specified row. Do not add a third row argument to SetValue. SetLine validates the current row before moving; GoLine can move even when it is invalid and should not bypass validation routinely. Length includes deleted rows by default and can count active rows only. Submodel changes do not confirm full-model persistence. (Sources: refs. 1–1.)

02 · SYNTAX

Syntax

oGrid:SetValue(cId,xValue) -> lOk
03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"

User Function Ed517()
    // Requires a submodel object and defined field; block not invoked.
    Local bUpdate := {|oGrid,cField,xValue| oGrid:SetValue(cField,xValue)}
    ConOut(ValType(bUpdate))
Return Nil
Expected result

Prints B. In the actual integration, check the logical update result. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Obtain the submodel from the correct model and respect insert/update actions and process validation. Avoid editing aCols directly as if this were a legacy grid.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. FWFormGridModel. TDN. Accessed on 2026-10-27.
Status
Under review
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR
0 approved comment(s)

Comments

There are no approved comments yet.

Sign in with Google or Microsoft to comment.

Powered by Usina Docs · Alpha