working interactively with microsoft visual foxpro welcome to sde rainer becker
TRANSCRIPT
Working interactively with Working interactively with Microsoft Visual FoxProMicrosoft Visual FoxPro
Welcome to SDEWelcome to SDE
Rainer BeckerRainer Becker
Rainer BeckerRainer Becker
dFPUGdFPUG– Online offersOnline offers– Loose Leaf MagazineLoose Leaf Magazine
VFP-DevConVFP-DevCon
VFP-Lokal/DevelopVFP-Lokal/Develop
Framework Visual ExtendFramework Visual Extend
MVP, MCP, ISVMVP, MCP, ISV
Wizards & Builders GmbHWizards & Builders GmbH
TopicsTopics
DataExplorer –easy way to discover DataExplorer –easy way to discover the datamodel and to run queriesthe datamodel and to run queries
Command Window – the control Command Window – the control center mainly used for browsing datacenter mainly used for browsing data
Correct settings in Visual FoxPro 9.0 Correct settings in Visual FoxPro 9.0 to avoid confusion within the teamto avoid confusion within the team
Working with the View Designer to Working with the View Designer to create/save basic SQL statementscreate/save basic SQL statements
Data ExplorerData Explorer
A visual tool A visual tool to navigate in tables and to navigate in tables and to test SQL-statementsto test SQL-statements
How to callHow to call
Via Menu:Via Menu:– Tools -> TaskPane -> MoreTools -> TaskPane -> More
Via Command Window:Via Command Window:– DO home() + „dataexplorer.app“DO home() + „dataexplorer.app“– … … with „-M“with „-M“
Via Configuration FileVia Configuration File– config.fpwconfig.fpw– command = do …command = do …
Add a ConnectionAdd a Connection
To a Database ContainerTo a Database Container
To a Tables directoryTo a Tables directory
To a Microsoft SQL-ServerTo a Microsoft SQL-Server– (local)(local)– over the Internetover the Internet– available for VFP as a WebServiceavailable for VFP as a WebService
Add Directories insteadAdd Directories instead
Directories to Add:Directories to Add:– adds all DBCs of given directoryadds all DBCs of given directory– does NOT add all tables of directory!does NOT add all tables of directory!
problem with free tablesproblem with free tables– not shown in directory view…not shown in directory view…– you can add them one by one…you can add them one by one…– we should move all of them to DBCs…we should move all of them to DBCs…
Node TablesNode Tables
Shows Table NamesShows Table Names
Expands to Field NamesExpands to Field Names– does not display commentsdoes not display comments– can display structure informationcan display structure information– Options: Checkbox: Show Column InfoOptions: Checkbox: Show Column Info– RightClick: Checkbox: Show Col InfoRightClick: Checkbox: Show Col Info
„„Design“ for Structure ModificationDesign“ for Structure Modification
Run QueryRun Query
Define QueryDefine Query
Run QueryRun Query
Save QuerySave Query
Copy Query to ClipboardCopy Query to Clipboard
Copy Results to ClipboardCopy Results to Clipboard
AddOn: Copy Results to ExcelAddOn: Copy Results to Excel– if interesting code should be shownif interesting code should be shown
Node Stored ProceduresNode Stored Procedures
Unique Key GenerationUnique Key Generation– GetNewKey()GetNewKey()
Other Key GenerationOther Key Generation– SetSRSKey()SetSRSKey()– SetPDefKey()SetPDefKey()– SetPListKey()SetPListKey()
Node ViewsNode Views
View DefinitionView Definition
Browse ResultsBrowse Results
Run Query (select * from view…)Run Query (select * from view…)
DesignDesign
New Views should be stored in a New Views should be stored in a separate DBC as they otherwise will separate DBC as they otherwise will get lost with next application update!get lost with next application update!
Command WindowCommand Window & Browse Window & Browse Window
The non-visual interfaceThe non-visual interfacefor about everything butfor about everything but
escpecially for browsing dataescpecially for browsing data
Basic Directory commandsBasic Directory commands
CD <directory>CD <directory>– MD <dir>, RD <dir> as well like DOSMD <dir>, RD <dir> as well like DOS
SET PATH TO <dir,dir,dir> [ADDI]SET PATH TO <dir,dir,dir> [ADDI]– search path for file-based commandssearch path for file-based commands
Results are shown in the DesktopResults are shown in the Desktop
If not visible, use Outshow-KeycodeIf not visible, use Outshow-Keycode– Ctrl+Shift+Alt (do not mix with Del)Ctrl+Shift+Alt (do not mix with Del)
Basic Table commandsBasic Table commands
USE <table>USE <table>– AGAIN SHARED or EXCLUSIVEAGAIN SHARED or EXCLUSIVE– IN 0 (not yet used workarea)IN 0 (not yet used workarea)– ORDER <index tag name>ORDER <index tag name>– ALIAS <local name>ALIAS <local name>– NOUPDATE (for read-only access!)NOUPDATE (for read-only access!)
USE [IN <alias>] (to close one)USE [IN <alias>] (to close one)
CLOSE TABLES (to close all)CLOSE TABLES (to close all)
Exclusive Table commandsExclusive Table commands
CREATE <table>CREATE <table>
MODIfy STRUctureMODIfy STRUcture– non-exclusive if you just want to lock…non-exclusive if you just want to lock…
ZAP (remove all records)ZAP (remove all records)
PACK (remove deleted records)PACK (remove deleted records)– never do this in Shark! First RECALL all never do this in Shark! First RECALL all
records, delete/pack and then delefordelrecords, delete/pack and then delefordel
REINDEX (recreate index)REINDEX (recreate index)
Basic Database CommandsBasic Database Commands
OPEN DATAbase ? | <dbcname>OPEN DATAbase ? | <dbcname>
MODIfy DATAbase ? | <dbcname>MODIfy DATAbase ? | <dbcname>– to view all tables / contentsto view all tables / contents– automatically opens databaseautomatically opens database
CLOSE DATAbase [ALL]CLOSE DATAbase [ALL]
SET DATAbase TO <name>SET DATAbase TO <name>– to switch current database / see toolbarto switch current database / see toolbar
VALIdate DATAbase [RECOVER]VALIdate DATAbase [RECOVER]
Table contents viewingTable contents viewing
BROWseBROWse– NOCAptions (to show real field names)NOCAptions (to show real field names)– FIELDS <field names> (to limit cols)FIELDS <field names> (to limit cols)– NOEDit (to prevent changes!)NOEDit (to prevent changes!)
use ESCape key if you changed by accident!use ESCape key if you changed by accident!
– NODElete (to prevent deletions!)NODElete (to prevent deletions!)– FOR <complex condition(s)>FOR <complex condition(s)>
Extended BROWSEExtended BROWSE
Resize/Rearrange with MouseResize/Rearrange with Mouse
Doubleclick for AutoFit of ColumnsDoubleclick for AutoFit of Columns
LEDIT/REDIT PARTITION for edit LEDIT/REDIT PARTITION for edit section in left/right part of gridsection in left/right part of grid
IN MACDESKTOP (for separate IN MACDESKTOP (for separate window)window)
Additional menu functions that Additional menu functions that sometimes might be helpfullsometimes might be helpfull
Saving Browse SettingsSaving Browse Settings
SET RESOurce ONSET RESOurce ON– Table FOXUSER createdTable FOXUSER created
BROW PREFerence <name> to load BROW PREFerence <name> to load (or create if first time) a setting(or create if first time) a setting– Close with Ctrl+Q to not save changesClose with Ctrl+Q to not save changes
or just use BROWse LAST to restore or just use BROWse LAST to restore last configuration…last configuration…
Contents FilteringContents FilteringFOR <complex condition>FOR <complex condition>– as long as based on current table!as long as based on current table!
relational filtering needs an relational filtering needs an additional step like:additional step like:– and seek( <column>, „<otheralias>“, and seek( <column>, „<otheralias>“,
„order“) and <otheralias>.<fieldname> „order“) and <otheralias>.<fieldname> = <value>= <value>
very fast but for more complex very fast but for more complex filtering SQL has to be used!filtering SQL has to be used!
Split up Browse commandSplit up Browse command
Use SET FIELDS TO beforehand to Use SET FIELDS TO beforehand to limit columns to be shownlimit columns to be shown
Use SET FILTER TO beforehand to Use SET FILTER TO beforehand to limit records to be shownlimit records to be shown
Use SET ORDER TO to set the order Use SET ORDER TO to set the order how the records are displayedhow the records are displayed
Use SET DELETED ON/OFF to show Use SET DELETED ON/OFF to show deleted records or notdeleted records or not
Other StuffOther Stuff
Call command window with Ctrl+F2Call command window with Ctrl+F2
Show Desktop with Ctrl+Alt+ShiftShow Desktop with Ctrl+Alt+Shift
Clear Desktop with CLEARClear Desktop with CLEAR
Commands are logged and you can Commands are logged and you can scroll back till last Cleanup commandscroll back till last Cleanup command
Mark multiple lines and select Mark multiple lines and select „Execute Selection“ in rightlick-menu„Execute Selection“ in rightlick-menu
End session with QUITEnd session with QUIT
Settings / OptionsSettings / Options
Ease your lifeEase your lifewith the correct with the correct
environment settingsenvironment settings
Where to findWhere to find
Directly enter in command windowDirectly enter in command window– Syntax: SET <XYZ> TO <val>/ON/OFFSyntax: SET <XYZ> TO <val>/ON/OFF
Write into configuration fileWrite into configuration file– modi file home() + „config.fpw“modi file home() + „config.fpw“– Syntax: <XYZ> = <val>/ON/OFFSyntax: <XYZ> = <val>/ON/OFF
Use Tools -> Options dialogUse Tools -> Options dialog– for permanent saving in the registryfor permanent saving in the registry– if you select „Save as Default“ only!if you select „Save as Default“ only!
View PageView Page
Status BarStatus Bar
ClockClock
Command ResultsCommand Results
System MessagesSystem Messages
Optional: Last ProjectOptional: Last Project
Optional: MRU list to the maxOptional: MRU list to the max
General PageGeneral Page
Cancel on EscapeCancel on Escape
Log compilation errorsLog compilation errors
Set Development on (compare time)Set Development on (compare time)
Confirm file replacementConfirm file replacement
Enter or tab to exit fieldsEnter or tab to exit fields
Strict Date LevelStrict Date Level
Data PageData PageNEVER open exclusive on Server!NEVER open exclusive on Server!show field namesshow field namesprompt for code pageprompt for code pageignore deleted recordsignore deleted recordsrushmore optimizationrushmore optimizationCollating Sequenze MachineCollating Sequenze MachineNO automatic file locking!NO automatic file locking!NO String comparison settings!NO String comparison settings!
File Locations PageFile Locations Page
Default DirectoryDefault Directory
Search PathSearch Path– include all your data directoriesinclude all your data directories
Optional: Start up programOptional: Start up program
Regional PageRegional Page
NEVER Use System Settings!NEVER Use System Settings!
Date FormatDate Format
Date SeparatorDate Separator
Century ONCentury ON
Decimal separatorDecimal separator
1000 separator1000 separator
Week starts on / First week of YearWeek starts on / First week of Year
Editor PageEditor Page
Comment string should be the sameComment string should be the same
You might use syntax coloringYou might use syntax coloring– I always do …I always do …
RecommendationRecommendationSettings should be the same for all Settings should be the same for all team members that exchange SQL-team members that exchange SQL-statements to prevent confusion!statements to prevent confusion!– can be extractet from registry as a .reg-can be extractet from registry as a .reg-
file, double-click applies settings locallyfile, double-click applies settings locally
Never forget to Click „Save as Never forget to Click „Save as Default“ before clicking „OK“Default“ before clicking „OK“Shift+OK copies settings as Shift+OK copies settings as commands to open debugout window commands to open debugout window if debugger is openif debugger is open