This is the oldest style found in VFP, inherited from its ancestors (dBase, FoxBASE). It treats data navigation like a tape deck.
The Code Scenario: You need to give a 10% raise to all employees in the "Sales" department who were hired before 2010.
The PDF Example:
USE employees SHARED EXCLUSIVE
* Always open tables in shared mode for network safety
SET ORDER TO TAG dept_tag
SEEK "Sales"
IF FOUND()
SCAN REST WHILE department = "Sales"
IF hire_date < ^2010-01-01
REPLACE salary WITH salary * 1.10
* The REPLACE command modifies the current record buffer
ENDIF
ENDSCAN
ENDIF
USE
Analysis:
Purpose: create a basic report from a cursor.
Steps:
Code:
SELECT * FROM HighValueOrders INTO CURSOR rptCursor
REPORT FORM HighValueReport PREVIEW
Notes:
When you open a PDF titled "Visual FoxPro Programming Examples," you will almost certainly see these three specific coding archetypes. They represent the core philosophy of the language: Data First. visual foxpro programming examples pdf