` Relate:file.Update() using contraints in Source code (Dan Presnell ) - Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Icetips Article

Back to article list   Search Articles     Add Comment     Printer friendly     Direct link  

Par2: Relate:file.Update() using contraints in Source code
1998-09-19 -- Dan Presnell
 
I've found what's missing from the code. When you are coding your source procedure, and you are changing the key field contents of a parent file record, you have to issue this command first, before you make the changes: relate:filename.save This procedure call saves the current key contents to a buffer. So the code will be something like this: relate:cust.save cus:id= relate:cust.update Note that access:filename.next() or other record retrieval procedures will NOT do this field saving for you. You have to do relate:filename.save first, so that the RelationManager will know, on the update call, that key fields have changed. So my previous code, which was this: relate:cust.open() set(cust) loop if access:cust.next() then break. if ! replace key field here relate:cust.update() end end relate:cust.close ...becomes this: relate:cust.open() set(cust) loop if access:cust.next() then break. if relate:cust.save ! replace key field here relate:cust.update() end end relate:cust.close ... and everything works okay. Warning. I have not tested this in many circumstances. If you look at the documentation for the RelationManager.save method, you will see that it is pitifully inadequate and fails totally to explain what the heck is going on. Also, there is a lack of any reference to the Save method in the documentation for the RelationManager.Update method, which should be corrected.


Today is April 25, 2024, 6:12 pm
This article has been viewed 35108 times.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: