310 likes | 469 Views
Working interactively with Microsoft Visual FoxPro. Welcome to SDE Rainer Becker. Rainer Becker. dFPUG Online offers Loose Leaf Magazine VFP-DevCon VFP-Lokal/Develop Framework Visual Extend MVP, MCP, ISV Wizards & Builders GmbH. Topics.
E N D
Working interactively with Microsoft Visual FoxPro Welcome to SDE Rainer Becker
Rainer Becker • dFPUG • Online offers • Loose Leaf Magazine • VFP-DevCon • VFP-Lokal/Develop • Framework Visual Extend • MVP, MCP, ISV • Wizards & Builders GmbH
Topics • DataExplorer –easy way to discover the datamodel and to run queries • Command Window – the control center mainly used for browsing data • Correct settings in Visual FoxPro 9.0 to avoid confusion within the team • Working with the View Designer to create/save basic SQL statements
Data Explorer A visual tool to navigate in tables and to test SQL-statements
How to call • Via Menu: • Tools -> TaskPane -> More • Via Command Window: • DO home() + „dataexplorer.app“ • … with „-M“ • Via Configuration File • config.fpw • command = do …
Add a Connection • To a Database Container • To a Tables directory • To a Microsoft SQL-Server • (local) • over the Internet • available for VFP as a WebService
Add Directories instead • Directories to Add: • adds all DBCs of given directory • does NOT add all tables of directory! • problem with free tables • not shown in directory view… • you can add them one by one… • we should move all of them to DBCs…
Node Tables • Shows Table Names • Expands to Field Names • does not display comments • can display structure information • Options: Checkbox: Show Column Info • RightClick: Checkbox: Show Col Info • „Design“ for Structure Modification
Run Query • Define Query • Run Query • Save Query • Copy Query to Clipboard • Copy Results to Clipboard • AddOn: Copy Results to Excel • if interesting code should be shown
Node Stored Procedures • Unique Key Generation • GetNewKey() • Other Key Generation • SetSRSKey() • SetPDefKey() • SetPListKey()
Node Views • View Definition • Browse Results • Run Query (select * from view…) • Design • New Views should be stored in a separate DBC as they otherwise will get lost with next application update!
Command Window & Browse Window The non-visual interfacefor about everything butescpecially for browsing data
Basic Directory commands • CD <directory> • MD <dir>, RD <dir> as well like DOS • SET PATH TO <dir,dir,dir> [ADDI] • search path for file-based commands • Results are shown in the Desktop • If not visible, use Outshow-Keycode • Ctrl+Shift+Alt (do not mix with Del)
Basic Table commands • USE <table> • AGAIN SHARED or EXCLUSIVE • IN 0 (not yet used workarea) • ORDER <index tag name> • ALIAS <local name> • NOUPDATE (for read-only access!) • USE [IN <alias>] (to close one) • CLOSE TABLES (to close all)
Exclusive Table commands • CREATE <table> • MODIfy STRUcture • non-exclusive if you just want to lock… • ZAP (remove all records) • PACK (remove deleted records) • never do this in Shark! First RECALL all records, delete/pack and then delefordel • REINDEX (recreate index)
Basic Database Commands • OPEN DATAbase ? | <dbcname> • MODIfy DATAbase ? | <dbcname> • to view all tables / contents • automatically opens database • CLOSE DATAbase [ALL] • SET DATAbase TO <name> • to switch current database / see toolbar • VALIdate DATAbase [RECOVER]
Table contents viewing • BROWse • NOCAptions (to show real field names) • FIELDS <field names> (to limit cols) • NOEDit (to prevent changes!) • use ESCape key if you changed by accident! • NODElete (to prevent deletions!) • FOR <complex condition(s)>
Extended BROWSE • Resize/Rearrange with Mouse • Doubleclick for AutoFit of Columns • LEDIT/REDIT PARTITION for edit section in left/right part of grid • IN MACDESKTOP (for separate window) • Additional menu functions that sometimes might be helpfull
Saving Browse Settings • SET RESOurce ON • Table FOXUSER created • BROW PREFerence <name> to load (or create if first time) a setting • Close with Ctrl+Q to not save changes • or just use BROWse LAST to restore last configuration…
Contents Filtering • FOR <complex condition> • as long as based on current table! • relational filtering needs an additional step like: • and seek( <column>, „<otheralias>“, „order“) and <otheralias>.<fieldname> = <value> • very fast but for more complex filtering SQL has to be used!
Split up Browse command • Use SET FIELDS TO beforehand to limit columns to be shown • Use SET FILTER TO beforehand to limit records to be shown • Use SET ORDER TO to set the order how the records are displayed • Use SET DELETED ON/OFF to show deleted records or not
Other Stuff • Call command window with Ctrl+F2 • Show Desktop with Ctrl+Alt+Shift • Clear Desktop with CLEAR • Commands are logged and you can scroll back till last Cleanup command • Mark multiple lines and select „Execute Selection“ in rightlick-menu • End session with QUIT
Settings / Options Ease your lifewith the correct environment settings
Where to find • Directly enter in command window • Syntax: SET <XYZ> TO <val>/ON/OFF • Write into configuration file • modi file home() + „config.fpw“ • Syntax: <XYZ> = <val>/ON/OFF • Use Tools -> Options dialog • for permanent saving in the registry • if you select „Save as Default“ only!
View Page • Status Bar • Clock • Command Results • System Messages • Optional: Last Project • Optional: MRU list to the max
General Page • Cancel on Escape • Log compilation errors • Set Development on (compare time) • Confirm file replacement • Enter or tab to exit fields • Strict Date Level
Data Page • NEVER open exclusive on Server! • show field names • prompt for code page • ignore deleted records • rushmore optimization • Collating Sequenze Machine • NO automatic file locking! • NO String comparison settings!
File Locations Page • Default Directory • Search Path • include all your data directories • Optional: Start up program
Regional Page • NEVER Use System Settings! • Date Format • Date Separator • Century ON • Decimal separator • 1000 separator • Week starts on / First week of Year
Editor Page • Comment string should be the same • You might use syntax coloring • I always do …
Recommendation • Settings should be the same for all team members that exchange SQL-statements to prevent confusion! • can be extractet from registry as a .reg-file, double-click applies settings locally • Never forget to Click „Save as Default“ before clicking „OK“ • Shift+OK copies settings as commands to open debugout window if debugger is open