|DBGetCurrRecVal -- Get the value of the current record|
DBGetCurrRecVal(control-code [, decryt-field-list, decryption-key])
Once you have arrived in your database at the record whose value you wish to retrieve, you can retrieve its contents with the FileFlex DBGetCurrRecVal function.|
This function works by evaluating a control-code and returning record values based on that control code. Valid control codes are:
You can return the contents of all the fields in the current record. After executing the following command, line 1 of the container will contain the record number, line 2 the delete flag, and all subsequent lines the data in the file, with the name, type, and value of each field (separated by commas) each field on its own line.
put DBGetCurrRecVal("A") into field Contents
DBGetCurrRecVal does NOT return the values of memo fields in the file if you use this method. You must retrieve each memo field separately using the GetMemo function in that case.
You can retrieve fields from the database file directly into global variables. In most development tools, FileFlex retrieves those database fields which have a global variable of the same name--if a global doesn't exist, it is created. If you use the "G" parameters to place retrieved data into global variables, FileFlex will retrieve any memo field that has a corresponding global variable.
put DBGetCurrRecVal("G") into foo
When decrypting data, you'll need to pass a decryption field list to the command. A decryption field list consists of a list of field names, separated by commas (i.e., "SALARY,OFFER,MAX") of those fields you wish to decrypt. Fields not included in the decryption list will not be decrypted.
Be sure to check how your development environment handles globals. Some environments require globals to be pre-defined, others make globals static, storing data from one session to another. You'll need to know the characteristics of your development system to get the most joy and least surprises from this feature.
You can retrieve the contents of any database record whose number you know by combining the FileFlex function DBGo followed by the use of the DBGetCurrRecVal function. For example, to get the contents of record 23 and put them into their global variables, you would carry out these two lines of code:
put DBGo(23) into dbResult put GetCurrRecVal("G") into foo
If you don't know the number of the record you wish to retrieve, but you do know something about its contents, you can locate the record with either DBQuery or DBSeek.
The FileFlex 3.0 write and read functions contain the same capabilities and limits of previous versions, even though the FileFlex file format now supports all FoxPro data types including binary and huge memos. Future versions of FileFlex will add intelligent support for large object data typing, but we've got plenty to keep us busy with the current release.