Paradox Community
Search:

 Welcome |  What is Paradox |  Paradox Folk |  Paradox Solutions |
 Interactive Paradox |  Paradox Programming |  Internet/Intranet Development |
 Support Options |  Classified Ads |  Wish List |  Submissions 


Paradox Programming Articles  |  Beyond Help Articles  |  Tips & Tricks Articles  


Simulating Data Model Links via Filters
© 2002 Roy Frieband

Introduction

There may be circumstances when you want or have to create several unkeyed tables from code in the private directory or have to deal with multiple unkeyed tables for whatever reason. Using the following simple technique, you can simulate a data model link between the unkeyed tables that is fast and effective.


Example

For this example assume you have 4 unkeyed tables in the private directory. The table you want to use as the "master" in the simulated data model should have a unique integer field. Let's call this table ":PRIV:Mastertbl.db" and the unique integer field "ID". Let's call the other 3 tables ":PRIV:Detail1.db", ":PRIV:Detail2.db", ":PRIV:Detail3.db". Each of these tables should also have a nonunique integer field also called "ID" that corresponds to the "ID" field in the "master table".

Also for this example let's put tableframes on a form bound to each table. The tableframes are named Mastertf, Detail1tf, Detail2tf, Detail3tf to correspond to the above tables.

This code goes in the arrive method of the record object in the Mastertf tableframe:
var
  id              LongInt
  dyn             DynArray[]  String
  stField, stData String
endvar

dmGet("MASTERTABLE","ID",id)

stField = "ID"
stData = String(id)
dyn[stField] = stData

Detail1tf.setGenFilter(dyn)
Detail2tf.setGenFilter(dyn)
Detail3tf.setGenFilter(dyn)
Detail1tf.home()
Detail2tf.home()
Detail3tf.home()
The above code allows you to scroll through the Mastertf tableframe and the detail tableframes will change just as if they were linked to the master in the datamodel.


Discussion of this article


 Feedback |  Paradox Day |  Who Uses Paradox |  I Use Paradox |  Downloads 


 The information provided on this Web site is not in any way sponsored or endorsed by Corel Corporation.
 Paradox is a registered trademark of Corel Corporation.


 Modified: 15 May 2003
 Terms of Use / Legal Disclaimer


 Copyright © 2001- 2003 Paradox Community. All rights reserved. 
 Company and product names are trademarks or registered trademarks of their respective companies. 
 Authors hold the copyrights to their own works. Please contact the author of any article for details.