Usina BRAdvPL Guide
Sign in
← All topics
FUNCTIONUnder review

DBStruct

DBStruct() --> aStruct

Gets the physical structure exposed by the RDD.

DBStructAdvPL
01 · OVERVIEW

Overview

DBStruct returns field descriptors containing name, type, length and decimals. This alone does not represent SX3 rules, validations, sharing or indexes. Documentation uses length 10 for memo compatibility; it is not content capacity. The example only counts descriptors without reading records or reconstructing a production table. EDTRB identifies only an owned test table already open with the required schema and permissions; examples are not intended for standard tables. (TOTVS, n.d., ref. 1)

02 · SYNTAX

Syntax

DBStruct() --> aStruct

Return value

Array of arrays: field name, type, length and decimals.

03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"

User Function Ed342()
    Local aFields
    If Select("EDTRB") > 0
        aFields := EDTRB->(DBStruct())
        ConOut(cValToChar(Len(aFields)))
    EndIf
Return Nil
Expected result

Number of fields described by the RDD; table-dependent. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Check RDD, alias and pending operations. Navigation can flush updates; preserve context under the caller contract and handle errors in the complete routine.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. DBStruct. TDN. Accessed on 2026-10-26.
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