PDA

View Full Version : Structures in df



Glyn astill
22-Jul-2005, 03:46 AM
Hi all,

Does anybody know if it is possible to use structures in dataflex, for
example in order to copy an entire record from one file to another?

Does anybody have a link to the docs for using structures in df? I can't
seem to find any.

Cheers
Glyn

Joerg Thuemmler
22-Jul-2005, 04:59 AM
Glyn,

I never used structures in df before, but look at the "COPY_RECORDS"
command, which may do what you want...

regards

joerg

Glyn astill wrote:
> Hi all,
>
> Does anybody know if it is possible to use structures in dataflex, for
> example in order to copy an entire record from one file to another?
>
> Does anybody have a link to the docs for using structures in df? I can't
> seem to find any.
>
> Cheers
> Glyn

starzen
22-Jul-2005, 06:00 AM
Glyn

if you want to copy a record in the same file in CM do this

// first find record to be copied
.....

// then clear recnum
Move 0 to file.recnum

// now change index fields to make them unique for the new record
....

// now save record
Saverecord file

if you want to copy a record from one file to another you can use the
COPY_RECORDS command which will allow you to copy a specified number of
records from one file to another. It will copy only the fields that exist in
both files.

if you want to do it more manually you could do this to copy the data from
one file to another

GET_Attribute DF_FIELD_COUNT OF filename1 TO iCount

For FIELDINDEX From 1 TO iCount
Move filename1.recnum& TO filename2.recnum&
Loop


--
Michael Salzlechner
StarZen Technologies, Inc
http://www.starzen.com
DataFlex Addon products, consulting

Glyn astill
22-Jul-2005, 08:55 AM
Cheers for the replies both of you guys I will try copy_records.

Back to structures though, does anybody know where there is any
documentation on structures or defining types? I'm mainly just
interested in this.

StarZen Technologies wrote:
> Glyn
>
> if you want to copy a record in the same file in CM do this
>
> // first find record to be copied
> ....
>
> // then clear recnum
> Move 0 to file.recnum
>
> // now change index fields to make them unique for the new record
> ...
>
> // now save record
> Saverecord file
>
> if you want to copy a record from one file to another you can use the
> COPY_RECORDS command which will allow you to copy a specified number of
> records from one file to another. It will copy only the fields that exist in
> both files.
>
> if you want to do it more manually you could do this to copy the data from
> one file to another
>
> GET_Attribute DF_FIELD_COUNT OF filename1 TO iCount
>
> For FIELDINDEX From 1 TO iCount
> Move filename1.recnum& TO filename2.recnum&
> Loop
>
>

Bernhard Mandl
22-Jul-2005, 10:21 AM
You can use arrays for you purpose. Just copy the record buffer to an array
and back to the record buffer.

Bernhard

"Glyn astill" <glyn@wayahead.com> schrieb im Newsbeitrag
news:ddNW3TsjFHA.1716@dacmail.dataaccess.com...
> Cheers for the replies both of you guys I will try copy_records.
>
> Back to structures though, does anybody know where there is any
> documentation on structures or defining types? I'm mainly just interested
> in this.
>
> StarZen Technologies wrote:
>> Glyn
>>
>> if you want to copy a record in the same file in CM do this
>>
>> // first find record to be copied
>> ....
>>
>> // then clear recnum
>> Move 0 to file.recnum
>>
>> // now change index fields to make them unique for the new record
>> ...
>>
>> // now save record
>> Saverecord file
>>
>> if you want to copy a record from one file to another you can use the
>> COPY_RECORDS command which will allow you to copy a specified number of
>> records from one file to another. It will copy only the fields that exist
>> in
>> both files.
>>
>> if you want to do it more manually you could do this to copy the data
>> from
>> one file to another
>>
>> GET_Attribute DF_FIELD_COUNT OF filename1 TO iCount
>>
>> For FIELDINDEX From 1 TO iCount
>> Move filename1.recnum& TO filename2.recnum&
>> Loop
>>

Larry R Pint
22-Jul-2005, 12:16 PM
Glyn astill wrote:
> Hi all,
>
> Does anybody know if it is possible to use structures in dataflex, for
> example in order to copy an entire record from one file to another?
>
> Does anybody have a link to the docs for using structures in df? I can't
> seem to find any.
>
> Cheers
> Glyn
Structures are a new concept to Visual DataFlex. I'd be suprised if
they were implemented in character mode DataFlex. John T. would be a
better person to tell you if that's even possible. Sometimes you can
take packages from VDF and use them in DF, but I suspect this is a
runtime issue. If so, it may never be supported in character mode.

Larry Pint

Glyn astill
24-Jul-2005, 07:14 PM
Well I've actually used a few structures in df3.1d in order to use some
dlls using dfruncon but I do not understand properly how dataflex
handles them. Theres a basic description in this doc
http://www.dataaccess.com/whitepapers/DataFlex_And_DLLs.htm but I really
need to find the one that explains about structures in more depth.

Larry Pint wrote:

> Glyn astill wrote:
>
>> Hi all,
>>
>> Does anybody know if it is possible to use structures in dataflex, for
>> example in order to copy an entire record from one file to another?
>>
>> Does anybody have a link to the docs for using structures in df? I
>> can't seem to find any.
>>
>> Cheers
>> Glyn
>
> Structures are a new concept to Visual DataFlex. I'd be suprised if
> they were implemented in character mode DataFlex. John T. would be a
> better person to tell you if that's even possible. Sometimes you can
> take packages from VDF and use them in DF, but I suspect this is a
> runtime issue. If so, it may never be supported in character mode.
>
> Larry Pint

starzen
25-Jul-2005, 07:48 AM
Glyn

the structures used with DLL's are too inflexible for this

The way the old structures work is to reserve a block of memory nessecary to
store the whole structure and to define some compile time symbols to define
the offsets and lengths of all items in the structure.

An easier way to store a list of items such as a record buffer would be to
use the array class and simply store each field in an item in the array


--
Michael Salzlechner
StarZen Technologies, Inc
http://www.starzen.com
DataFlex Addon products, consulting

Joerg Thuemmler
26-Jul-2005, 12:20 AM
Glyn,

I found screen masks a good way to "simulate" structures. The
structure is "visible" (and easy to debug by outputting it) and you
can do some special formatting just in it (with "print" and formats)
and the relative access is done via "windowindex". Works fine with a
correspondending datafile with same fields as the mask...

joerg

StarZen Technologies wrote:
> Glyn
>
> the structures used with DLL's are too inflexible for this
>
> The way the old structures work is to reserve a block of memory nessecary to
> store the whole structure and to define some compile time symbols to define
> the offsets and lengths of all items in the structure.
>
> An easier way to store a list of items such as a record buffer would be to
> use the array class and simply store each field in an item in the array
>
>