FoxPro create table
It is very easy to create a table in FoxPro®. If you use a version of Visual Foxpro, there is a interactive command create table
Tool&Task uses this command in the program tt_create_table(). If you use these function in the programs you add and the commands tt_open_table() and tt_release_table(), Tool&Task will keep track of all open tables.
The challenge is learning the field definitions but with the Microsoft help mentioned above, it should be no problem.
The example creates a table and adds a few records. After closing the table you should try to open it again using the m_browse form.
***************************** | |
* Tool&Task example program * | |
* fox_tab_create() * | |
* last compile: 19.02.2022 * | |
***************************** |
tt = "(name c(20), land c(20))" |
&& -> Microsoft help |
tt_create_table("a_test", "TEMP\", tt) |
&& upper TEMP and backslash |
m.name = "John" |
&& 'memory variable' |
m.land = "USA" |
&& 'm.' + name of field |
insert into a_test from memvar |
&& add record |
m.name = "Rosi" |
&& using memvars |
m.land = "Germany" | |
insert into a_test from memvar |
&& fastest way |
m.name = "Nicole" | |
m.land = "France" | |
insert into a_test from memvar | |
* this is another method to add records: | |
append blank |
&& add an empty record |
replace name with "Olga" |
&& fill the fields |
replace land with "Russia" | |
* and you can write this into one line | |
append blank |
&& next empty line |
replace name with "Harry", land with "England" | |
scatter memvar |
&& record to memvars |
append blank |
&& new record |
gather memvar |
&& same data |
append blank |
&& change in browser |
replace name with "fill", land with "in" | |
wait "close browser clicking cross in the upper right - return clears message" window | |
browse |
&& now show the table |
tt_release_table("A_TEST") |
&& close the table |
do form m_browse.scx with gUserDataTT + "TEMP\a_test.dbf" | |
* the table will be opened and closed automatically |