Usina BRAdvPL Guide
Sign in
← All topics
FUNCTIONUnder review

NEGATIVO()

NEGATIVO() -> lOk

Validates a negative current-field value.

NEGATIVO()AdvPL
01 · OVERVIEW

Overview

This function does not take the value as an argument: it depends on the current editing variable or field. Documentation uses it in MSGET VALID. An isolated call with a number or string therefore does not represent its contract. The source calls POSITIVO/NEGATIVO inverses but does not clarify zero; test that boundary and use explicit comparison when rules require > 0 or < 0. (Sources: refs. 1–1.)

02 · SYNTAX

Syntax

NEGATIVO() -> lOk

Return value

Logical result for current content in the validation context.

03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"

User Function Ed556()
    Local oDlg
    Local nValue := -1
    // Validation depends on the field being edited.
    DEFINE MSDIALOG oDlg TITLE "Example" FROM 0,0 TO 100,300 PIXEL
    @ 12,12 MSGET nValue SIZE 100,12 OF oDlg PIXEL VALID NEGATIVO()
    ACTIVATE MSDIALOG oDlg CENTERED
Return Nil
Expected result

Opens a dialog and evaluates content during field validation; writes no data. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Run only in a UI session. Distinguish population, sign and business rules; test empty/cancellation cases too.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. NEGATIVO%28%29. 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