FWProfile
FWProfile():New()Organizes preferences by user, program and task.
Overview
The developer defines profile structure. SetProgram, SetTask, SetType and SetUser define persistence context; SetTask keys are limited to ten characters. The example manipulates an in-memory array without Load, Save or Delete. Load/Save control company/branch scope; SetCompany and SetBranch require LIB 20240226 or newer. (Sources: refs. 1–1.)
Syntax
FWProfile():New()Methods
SetProfileSets in-memory data.o:SetProfile(aProfile)
GetProfileReads application-defined structure.o:GetProfile() -> aProfile
Load / SaveLoads or persists in configured context.o:Load([lByEmpFil]) / o:Save([lByEmpFil])
DestroyReleases object and references.o:Destroy()
Commented example
#Include "Protheus.ch"
User Function Ed448()
Local oProf := FWProfile():New()
Local aProf
// Application-owned array, without persistence.
oProf:SetProfile({"ED01",20})
aProf := oProf:GetProfile()
ConOut(cValToChar(aProf[2]))
oProf:Destroy()
Return NilReads the configured second element: 20. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
- Version array structure and validate loaded content before indexing. Do not store passwords in profiles.
- Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.