From: "Manuel Candela" <msca53@h...> Date: Mon Jul 7, 2003 11:17 pm Subject: Using dbfs (Local database)
I expect of this files that they have some value as tools to manage existing dbase files, and to create new files too. Subs and funcs are "universal" ones in a sense: if you figure out other structures (called dictionaries too) the same ideas could be applied.
Regards! Manuel Candela _________________________________________________________________ Some observations: 1- To travel the table: a- Sequentially -> dbskip(n) where n indicates how many registrations from the current one Yes you advances, chequear eof (); but cheqear bof (). b- Aleatorily -> dbgoto(n) where n indicates the number of the objective registration.
2- To obtain data of a field, invoke fieldget(i), where i is the position of the field like it was defined when creating the table. If this procedure is uncomfortable, just use i = fieldpos(nameOfField). It could be useful an include file with significant definitions for the indexes of the fields. If definitively the name of the fields is known, you could use something as: defstr campo1 campo1 = fielget(fieldpos (campo1)) being assumed that it is a string.
3- To write data to a field it should be used fieldput(i, cString, any) for a string fieldput(i, any, number) for a numeric field Date fields and memos are worked as strings. For logical fields use (.F., .T.), which are numbers.. When are fields type memo, the recommended procedure is richedit.text = fieldget(x), and but ahead if richedit.modified then fieldput(x, richedit.text, anynumber <> -1) end if If what is sought is a forced update, use fieldput(x, text, -1)
4- recno() it returns the number of the pointed register, fcount() it returns the count of the fields of the table. dbZap annihilates the data of the table. dbgotop leaves us in the first register of the table dbgobottom leaves us in the last one dbAppend adds a clean register at the end of the table (it should de called dbAppendBlank)
5- dbLocate() and dbScan() were addet to illustrate the use of the previous procedures
6- The procedures in <dbt.inc>, they are delicate and therefore they should be considered as hidden.
7- The added example this organized one as a test session. If you are able to find the correct order, everything would be clarified.
WHAT WILL COME SOON
1- The possibility to open several charts in the same application, or even better, QDbase! 2- Regarding indexes, I prefer to accumulate the data of the searches in an array and at the same time their respective register number and then to travel using dbgoto(x). And clear, can the arrays be ordered and to write to a file (or to a DBase table?). Will we See..
PS Any observation, suggestion, critic, addition, etc.. it will be well received. I want to mention these two names: Rick Spence Stephen J. Straley, co-developers of Clipper-Dbase. |