Need help in copying a record.... 
Author Message
 Need help in copying a record....

I am fairly new to Clarion, so maybe this explains my struggle....  I have a
subscription database with renewal dates. I am sure that I am missing
something, but I cannot copy the record with its children to a new record.

Here is what I need to do:
Once the subscription is up, I want to copy the record (parent and children)
to a "new" record (ready for new subscription). I have to keep the old
record. But I want to avoid reinputing all of the data in the new record
which for the most part does not change.

Any suggestions?

Doug Peters



Sat, 12 May 2001 03:00:00 GMT  
 Need help in copying a record....
 am sure that I am missing
something, but I cannot copy the record with its children to a new record.

Try this:

OldRecordId = 'X'
NewRecordId = 'Y'

PNT:RecordId = 'X'
GET(Parent,PNT:RecordKey)
PNT:RecordId = NewRecordId
Add(Parent)
ChildRecordId = OldRecordId
SET(CHD:RecordKey,CHD:RecordKey)
LOOP
  NEXT(CHILD)
  IF CHD:RecordId ~= OldRecordId THEN BREAK.
  CHD:RecordId = NewRecordId
  ADD(CHILD)
END



Sun, 13 May 2001 03:00:00 GMT  
 Need help in copying a record....
Rather than use two files then copying the record why dont you just have a flag
(a byte field) in the regular file. A 1 in the field would indicated that the
subscribtion is up, a 0 means still active.  Every day you could run a
procedure that would run through the file and  "check" for expired
subscriptions. Flag them and then from there you could do anything, run reports
view in a different browse procedure, etc using a record filter or selector. IF



Sun, 13 May 2001 03:00:00 GMT  
 Need help in copying a record....
Thank you for your help. I have a lot to learn in a short period!!

I am still having a little trouble. I placed a button the browse and put the
following code snippet in the Before Generated Code section. When pressed I
get a "new" record without a record number and no other data.

Is it possible that I have not correctly interpreted your reply?

!BusinessID = 'X'
!NewBusinessID = 'Y'

BUS:BusinessID = 'X'
GET(Business,BUS:KeyBusinessID)
BUS:BusinessID = 'Y'
ADD(Business)
FAC:BusinessID = 'X'
SET(FAC:KeyFacilityID,FAC:KeyFacilityID)
    LOOP
    NEXT(Facility)
    If FAC:BusinessID ~= 'X'THEN BREAK
    FAC:BusinessID = 'Y'
    ADD(Facility)
END
.

Quote:

> am sure that I am missing
>something, but I cannot copy the record with its children to a new record.

>Try this:

>OldRecordId = 'X'
>NewRecordId = 'Y'

>PNT:RecordId = 'X'
>GET(Parent,PNT:RecordKey)
>PNT:RecordId = NewRecordId
>Add(Parent)
>ChildRecordId = OldRecordId
>SET(CHD:RecordKey,CHD:RecordKey)
>LOOP
>  NEXT(CHILD)
>  IF CHD:RecordId ~= OldRecordId THEN BREAK.
>  CHD:RecordId = NewRecordId
>  ADD(CHILD)
>END



Sun, 13 May 2001 03:00:00 GMT  
 Need help in copying a record....


Quote:
> Once the subscription is up, I want to copy the record (parent and children)
> to a "new" record (ready for new subscription). I have to keep the old
> record. But I want to avoid reinputing all of the data in the new record
> which for the most part does not change.

Doug

Castle computers have a set of templates which include one for

are reasonably priced (otherwise I would not have splashed out :-)

--
David Proudfoot
Thurso
Caithness



Sun, 13 May 2001 03:00:00 GMT  
 Need help in copying a record....
Is it possible that I have not correctly interpreted your reply

The code assumes that there is a record with
a record ID = 'X', actually there should be some error checking after the GET
such as
GET(Business,BUS:KeyBusinessID)
IF ERRORCODE = 35 THEN
    MESSAGE('Record Not Found')
END
The record ID must be a unique identifier identifying a parent record.  If it
is a multiple
key you may need to set all of the fields of the
multiple field.  But if there is a record with the ID = 'X' the code should
work.



Mon, 14 May 2001 03:00:00 GMT  
 Need help in copying a record....
Good idea but this doesn't give me a separate record with related child
records. I am unable to simply edit the existing records, they are insurance
policies that the company needs to keep in the file.

Thanks for the reply
Doug

Quote:

>Rather than use two files then copying the record why dont you just have a
flag
>(a byte field) in the regular file. A 1 in the field would indicated that
the
>subscribtion is up, a 0 means still active.  Every day you could run a
>procedure that would run through the file and  "check" for expired
>subscriptions. Flag them and then from there you could do anything, run
reports
>view in a different browse procedure, etc using a record filter or
selector. IF




Sun, 20 May 2001 03:00:00 GMT  
 Need help in copying a record....
Thanks for the suggestion. I got the template, but it will only copy the
parent record. And it does it well! But my child records are left behind. I
am still left with the same basic problem. And tooooooo many hours trying to
resolve it. I suppose it is good experience, but {*filter*} the sleeping!

Quote:



>> Once the subscription is up, I want to copy the record (parent and
children)
>> to a "new" record (ready for new subscription). I have to keep the old
>> record. But I want to avoid reinputing all of the data in the new record
>> which for the most part does not change.

>Doug

>Castle computers have a set of templates which include one for

>are reasonably priced (otherwise I would not have splashed out :-)

>--
>David Proudfoot
>Thurso
>Caithness



Sun, 20 May 2001 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. FOR THE RECORD(WAS:re:I need a copy of fortran)

2. CW2.003 File copy changes the date.....need a way to copy w/o date change

3. Need copy of Meridian Open Ada - will purchase copy

4. Urgent Help Needed !!! RE:Copying of procedures

5. C4a-abc Need Help With Creating a Copy Button

6. Need help copying a file to the printer

7. Desperately need help with Cut/Copy/Paste functions

8. Copy Protection help needed

9. Help, need to copy a 1474560 (1.404M) byte file to floppy disk

10. Simple directory copy routine - need help please

11. NEED HELP ON THE COPY STATEMENT PLZ!?!?!?!

12. Application wide Cut/Copy/Paste -- Need help

 

 
Powered by phpBB® Forum Software