CarlAndrew Posted April 21, 2005 Posted April 21, 2005 Hi, I've come across this problem a few times and hope someone might have been down this track before me! This is what I'm trying to do; I have 3 layouts - "Person", "Car" and "Events". One "Car" record can have many "Events" reocrds. When I look at one "Events record" I would like to have a script that finds ALL "Events records" for the related "Car record". These "Events" records would have the same 1st field/value (ID) but other fields would have unique values. So I've made a script that does this (keep in mind that I'm a newbie at FM7 :-) Go To Layout [Events] Go To Field[select/Perform, Events::ID] PerformFind[] SortRecords[] But how do I specify the search criteria? I can't specify it in PerformFind that I want all records that have the same ID!? Don't know if there is simpler way to do this?! Kind Regards Andrew Carruthers
comment Posted April 21, 2005 Posted April 21, 2005 There are several ways: If you want to go thru Find, you need to "remember" the CarID somewhere, so that you can use it in your find request in Events. You could use a global field for this, but it is simpler to define CarID as the script parameter in the button calling the script. Then: Go To Layout [Events] Enter Find Mode [] Set Field [ Events::CarID ; Get ( ScriptParameter ) ] PerformFind[] But, since you already have a relationship between the Car record and its related Events, the simplest way is: Go to Related Record [ From table: "Events"; Using layout: "Events" (Events) ] [ Show only related records ]
CarlAndrew Posted April 22, 2005 Author Posted April 22, 2005 Hi Comment, thanks for your help! Hope you can help me some more bucause I can't seem to make it work. What happens is that ALL the Event records turn up which is not what I want. Maybe I didn't explain the relations enough?! I have the same field-type; ID in Car layout and Event layout, but for one car record there can be more than one Event record. I have an "=" relation between the Car and Event layouts. Hope this input can help you in helping me Once again, thanks for your time and help! Kind Regards Andrew
comment Posted April 22, 2005 Posted April 22, 2005 In ScriptMaker, when you select the Go to Related Record [] step, examine carefully all the options. One of them is "Show only related records". Make sure it is checked. The other thing to check: if you have more than one occurence of the Events table in the relationship graph, make sure you select the correct TO, i.e. the one that is connected to Cars via CarID.
CarlAndrew Posted April 26, 2005 Author Posted April 26, 2005 Hi Comment, Thanks for your answer, I've been away for a few days and not been able to read this great homepage I've followed your advice and done just this. The "GoToReleatedRecord" is ticket with the "Show only related records" option and the relation I've setup in "define Database" has one link of type '=' between both ID's in each layout. Still I get all records from the EventData layout. Is there any other way around this problem or should this work? Thanks for your help, Best Regards ANdrew
CarlAndrew Posted April 27, 2005 Author Posted April 27, 2005 Hi Comment Posting my file, hope this can help you see what I'm doing wrong Thanks for your help! Best Regards Andrew version3.zip
comment Posted April 27, 2005 Posted April 27, 2005 OK. We had a little misunderstanding. I thought you would be in the Car layout when asking to see the events related to THIS car. It turns out you want to be on some event in the Events layout, then asking to see all events that are ALSO related to the same car. Since there is no relationship between events, the thing to do is a quick hop to the related mama car, and go to related events from there. I have also added the option to do the same from the car layout, and a portal. Delete whatever you don't need. version3.fp7.zip
CarlAndrew Posted April 27, 2005 Author Posted April 27, 2005 You are a star - Thanks a lot ! Best Regards Andrew
Recommended Posts
This topic is 7149 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