Skip to content

Command API

The Command API keeps the DataFlex command-style database API available in the TechStack, but commands now target Data Dictionary objects and their local buffers instead of global file buffers.

Include: Use Db\DBCommands.pkg

Related: Data Dictionaries, Data Binding, cDataDictionary, Clear, Find, SaveRecord, Delete, Relate

Why command style still works

Older DataFlex Windows code used command calls shaped like Clear Customer or Find EQ Customer.Name against global file buffers. TechStack code ports those calls to DD handles and DD fields, for example Clear oCustomerDD and Find EQ oCustomerDD.Name.

Command-style calls expand to the same DD object calls documented in cDataDictionary. Choosing commands or Send / Get DD calls is a style and readability choice when both target the same DD object.

Every command must receive the DD object or DD field that owns the local buffer. When a procedure needs related data, provide the related DD objects and connect them with Set DDO_Server.

Standalone Relate is not part of the TechStack Command API. Use entity relations plus Set DDO_Server; normal DD save, find, and delete behavior maintains relationship state.

Command-to-DD translation

Command DD call it routes to Child page
Clear oDD Send Clear of oDD Clear
Find mode oDD.Field Send FindByField of oDD mode (RefTable(oDD.Field)) Find
Find mode oDD by index Send FindByIndex of oDD mode index Find
SaveRecord oDD Send SaveRecord of oDD SaveRecord
Delete oDD Send Request_Delete of oDD Delete
ZeroFile oDD Send ZeroFile of oDD ZeroFile
Get_Field_Value oDD field to var Get Field_Current_Value of oDD field to var Get_Field_Value
Constrain ... Send Add_Value_Constraint, Send Add_Field_Value_Constraint, or Send Add_Relates_To_Constraint Constrain
Entry_Item oDD.Field Send Bind_Data ... from a data-aware UI context Entry_Item
Begin_Transaction Send BeginTransaction of ghoDbTransactionManager and opens Try Begin_Transaction
End_Transaction Send CommitTransaction of ghoDbTransactionManager, rollback/re-raise on error End_Transaction
Relate No command translation; DD relationships replace the standalone command Relate

Porting pattern

Use Db\DBCommands.pkg

Procedure SaveCustomer String sName
    Clear oCustomerDD
    Move sName to oCustomerDD.Name
    SaveRecord oCustomerDD
End_Procedure

Procedure FindCustomer String sName
    Clear oCustomerDD
    Move sName to oCustomerDD.Name
    Find EQ oCustomerDD.Name
End_Procedure

Command pages

Record buffers:

Save/delete/storage:

Constraints and binding:

Transactions: