Usina BRAdvPL Guide
Sign in
← All topics
FUNCTIONUnder review

CriaTrab

CriaTrab( <aArray>, <lDbf> ) --> cNome

Distinguishes obtaining a name from creating a work file.

CriaTrabAdvPL
01 · OVERVIEW

Overview

The historical reference describes CriaTrab(aArray,lDbf): true creates a file using the structure; false only obtains a name. The official Crystal Reports integration example uses CriaTrab(Nil,.F.) for a support filename without demonstrating table creation in that call. This differs from a SQL temporary table managed by FWTemporaryTable. No current dedicated page was located; this page limits itself to the historical contract without guaranteeing local-driver support everywhere. The example only requests a name and does not write to it. (TOTVS, n.d., ref. 1; FERREIRA, 2023, ref. 2)

02 · SYNTAX

Syntax

CriaTrab( <aArray>, <lDbf> ) --> cNome

Parameters

aArray
AnyRequired

Field structure; Nil in name-only mode.

lDbf
LogicalRequired

True creates a file; false obtains a name under the historical contract.

Return value

Work-file name according to the historical reference.

03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"

User Function Ed317()
    Local cName := CriaTrab(Nil, .F.)
    // Creates no file; the name is not an open table.
    ConOut(cValToChar(Len(cName)))
Return Nil
Expected result

Generated-name length, with no fixed content assumed; the example creates no file. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Check infrastructure support and choose an appropriate temporary-table abstraction. Do not delete arbitrary files to free a name.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. CriaTrab. TDN. Accessed on 2026-10-26.
  2. FERREIRA, Bia. Advpl CriaTrab. Bynem, atualização de 25 jun. 2023. Referência histórica. 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