Copying a related record?

Questions, tips and tricks and techniques for scripting in Servoy

Copying a related record?

Postby IT2Be » Thu Dec 04, 2003 1:01 am

Can anyone tell me what would be the best method to copy the complete content of a related record into the current record?

Would that be field by field or can this be done any smarter?
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Postby Harry Catharell » Thu Dec 04, 2003 6:46 pm

Hi Marcel,

Have you thought about :

1) Isolate the related record export as tab or comma and then import it.
2) Use the controller.copyrecord command to capture the record tab delimited and then parse the data into the master record.
3) capture the serial_id of the related record and set that value into a global field in the master record to force a relookup of the data via relationship from global serial id to related serial id

Harry
Harry Catharell
 
Posts: 812
Joined: Fri Sep 26, 2003 10:23 am
Location: Milton Keynes, England

Postby IT2Be » Thu Dec 04, 2003 7:24 pm

Hai Harry,

Thanks for guiding me with my thoughtprocess. Here are my thoughts so far:

1. I don't like this. Looks like a too intensive/timeconsuming task...
2. This was my first thought but... When working with a related record (the one I want to copy) this copyrecord is not available.
3. Can you give me more details or an example? I don't think (or I am sure :lol: ) that I understand what you mean...
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Postby Harry Catharell » Fri Dec 05, 2003 1:03 am

For point 3) I assume that your related record has a unique serial id field.

If you capture the serial id of the related record from which you wish to move the field data you can then place that serial id value into a field within the master file.

If you have a relationship from that field in the master file to the serial id field in the related file then you have a link directly to the data that you wish to capture and move.

If you set the fields in the master file to have auto enter properties then you can run a relookup function (controller.relookup) based upon the relationship between master and related record set up above, which will lookup the data automatically for you.

Does this make sense ?
Harry Catharell
 
Posts: 812
Joined: Fri Sep 26, 2003 10:23 am
Location: Milton Keynes, England

Postby IT2Be » Fri Dec 05, 2003 1:25 am

Ah, ok now I understand. I will try this tomorrow... Thanks
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Postby maarten » Fri Dec 05, 2003 10:49 pm

I haven't tried this, but I imagine you could also do a direct query with the database manager, pushing the result into your main record.
Maarten Berkenbosch
User avatar
maarten
 
Posts: 797
Joined: Wed Apr 23, 2003 10:52 pm
Location: Amersfoort, Netherlands

Postby IT2Be » Fri Dec 05, 2003 11:39 pm

This was my first idea too but I don't like to go over all fields one by one and at the same time check it the fields correspond. Apart from the programming I will have to check appr. 7 records per go. I think this will take too much time.
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Postby IT2Be » Sat Dec 06, 2003 11:42 am

Harry thanks,

At least for the (initial) making of the record this works...
I will now see if your tip works when the record already exists...
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany


Return to Methods

Who is online

Users browsing this forum: No registered users and 4 guests