Newbies Luke Siemaszko Posted September 6, 2005 Newbies Posted September 6, 2005 Apologies for a noddy question, but I just can't find an answer to this anywhere. I am struggling to get a working where I have a one to many relationship, and want to step through all the related records. Imagine my "main" database that has a field called matchfield which is always "1". And I have a related database that has two fields, lets say "data" and "matchfield". "data" has records A, B, C, D, E, F.... "matchfield" is always 1 I want a layout based on the main database, and I want a script that will sequentially give me all the values in the related database. So I define a relationship main database:matchfield = related database:matchfield But now, how do I get each related record in turn? Whnat I have tried is go to layout belonging to related database go to first record loop got to layout belonging to main record do something with field related database:data got to layout belonging to related database got to next record, exit on last end loop But this always returns the *first* record from the related database. What am I doing wrong? Many thanks for any help.
-Queue- Posted September 6, 2005 Posted September 6, 2005 First of all, a constant match field is superfluous in version 7; you can create a relationship using the X operator to relate each record to all others. Secondly, you can create a value list of the related field and sort it by the related serial (assuming your serial numbers are increasing in order), then create an unstored text calculation in the main table of Substitute( ValueListItems( Get(FileName); "yourValueList" ); ¶; ", " ) for a comma-delimited list of the related field's values in creation order. FYI: relationship::field only refers to the first related record's field value, which is probably why your script was not working as desired.
DukeS Posted September 7, 2005 Posted September 7, 2005 Hi Luke, Maybe you can create a layout with main data and put on portal which displays data (that you want to modify) from related records. Then you create a script with GoToPortalRow script step and then in loop modify all of them.
Recommended Posts
This topic is 7358 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now