Welcome! Log In Create A New Profile

Advanced

How to move around a "recordful" of data?

Posted by Ola 
Ola
How to move around a "recordful" of data?
March 31, 2009 09:02PM
Hi all!

I would like to copy the active form's "screen record" to memory and then, if necessary, restore the copy back to "screen".

I've searched the help file back and forth many times, but could not find the appropriate command pair for these operations.

----------------------------------------------

Another, a little related situation:

With HRetrieveRecord I can copy a file buffer record to memory:

sRecordCopy is string = HRetrieveRecord(FILENAME)

But this works only partially, leaving binary memos and compost keys out, and there is no "HRestoreRecord" or equivalent command, or at least I could not find one.

---------------------------------------------
Now the question:

What would be the best way to copy a "recordful" of data between screen, memory and record buffer, without handling all the items separately, something like "ScreenToMemory", "MemoryToScreen" and "MemoryToFile", in the lines of the everyday workhorses FileToScreen and ScreenToFile?

Any hints, tips and sample codes will be appreciated!

Ola Pedersen
[www.pienoismalli.com]
Stefan Bentvelsen
Re: How to move around a "recordful" of data?
March 31, 2009 09:52PM
Hi Ola,

if you make an alias of the file (but without HCreation, etc.) you can use that alias as buffer for a backup of your record. With HCopyRecord() to copy the record-data from your original file to the alias and vice versa.

marcel.berman@managingbusiness.be.pcs
Re: How to move around a "recordful" of data?
April 01, 2009 08:43AM
Hi !
Concerning ScreenToMemory and MemoryFoScreen :
These functions exist in V14 (french names of the functions are
EcranVersSource and SourceVersEcran).
In order to use these functions, the possibility to bind a control to a
Structure or an object has been added to controls just like you can bind a
control to a field.
You can even bind a screen table to an array of objects !
I am using it and it is really a major enhancement !
So you just have to wait a little bit !

Regards !

--
Marcel Berman
Président de Be-Dev.be (www.be-dev.be) (Belgique)
Membre du CA de Wind'Asso (www.windasso.org) (France)
Be-Dev.be et Wind'Asso sont des associations d'utilisateurs des produits
PC-Soft
Message forwarded from pcsoft.us.windev
Thanks Stefan and Marcel!

Stefan,
I was aware of the alias + HCopyRecord, but somehow this feels to me like shooting a fly with a cannon. But thanks for pointing it out, I may have to use it.

Marcel,
This was good news. I look forward to getting ScreenToMemory and MemoryToScreen commands in version 14.

Similar kinds of commands for memory<->file moves, MemoryToFile and FileToMemory, exist already in version v. 11, and they also require the use of a structure or class variable to handle the memory side of the storage. Unfortunately there are no code samples in the on-line help on how to use these commands.

Can you - or anybody - give some sample on how to use a memory structure to hold a file buffer? Specifically, how can a file structure be built, without copying each item's properties separately to a structure? Ideally it would be something like:

CustomerStructure is a structure like Customer.Record

regards
Ola


Stefan Bentvelsen
Re: How to move around a "recordful" of data?
April 03, 2009 09:10AM
Hi Ola,

on the moment I use a class to temporarily save any record in my apps. In that class I use HRecordToXML() to put the record data in a string. In that class I have u.a. functions to restore the saved record, to compare the saved record with the current record and to get a specific field from the saved record.

But: items whose types are composite key, binary, binary memo are ignored!
marcel.berman@managingbusiness.be.pcs
Re: How to move around a "recordful" of data?
April 03, 2009 01:26PM
Hi !
It is very simple to build a class from the analysis ...
May be you don't know that WD can build UML schema from the analysis ...
and that WD can create classes from the UML schema ...
The nice thing is that once you have modfied one class, (added a method, or
a supplemental member) in the code, when you open the UML schema, WD ask you
if you want to bring the modification in the schema.
Also, if you change the UML schema, WD will propose to modify the class
accordingly ...
I do use this very regurlarly and it works fine ... BUT manage well your
backups ! If you change a class, and after, you modify the analysis, or the
contrary, without going through the UML schema, sometimes WD mess things and
you could find that you have loss things in your class ...
One thing that you should care off is that in the description of each UML
class, you have on option wich explain wich type of code will produced.
Because you can choose between OO or procedural code.
OO will produce a class with members corresponding to the fields of the
table
Procedural will produce a Procedure Collection containing only a structure
with members corresponding to the fields.
You can also specify this when creating the classes from the analysis.
But otherwise it works really well !
As I have only a French Version, I have some problems to give you the right
menu options to use but you could find these easely.
Hope this help !

--
Marcel Berman
Président de Be-Dev.be (www.be-dev.be) (Belgique)
Membre du CA de Wind'Asso (www.windasso.org) (France)
Be-Dev.be et Wind'Asso sont des associations d'utilisateurs des produits
PC-Soft
Message forwarded from pcsoft.us.windev
Thanks again guys,

It seems that I' ll have to start reading the UML documentation in the on-line help.

Best regards
Ola
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: