Usina BRAdvPL Guide
Sign in
← All topics
PRACTICAL GUIDEUnder review

Client and server files in Protheus

Identifies where File looks before designing a read workflow.

Client and server files in ProtheusAdvPL
01 · OVERVIEW

Overview

A path alone does not identify the machine. File accepts nWhere: 0 applies relative paths on Application Server and absolute paths on SmartClient; 1 searches the Application Server installation directory; 2 the SmartClient installation directory. In a Job, an absolute client-path lookup can return false and FError -1. lChangeCase affects case handling according to build and configuration. Existence does not establish read permission, content identity or transfer between machines. (TOTVS, n.d., ref. 1)

Return value

No single return value: this is a composite workflow.

03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"
User Function EdFiles()
    Local cFile := "editorial-test.txt"
    // Interactive session: lookup only, no creation or transfer.
    ConOut(cValToChar(File(cFile, 1, .F.)))
    ConOut(cValToChar(File(cFile, 2, .F.)))
Return Nil
Expected result

Two logical values depending on actual files at each installation. No fixed result or transfer is implied. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Define machine, allowed directory, name and error handling before opening. Do not accept arbitrary user paths; test SmartClient and Job separately.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. File. TDN. Documentação oficial. 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