Jump to content

Display Data from Second Related Record

This topic is 2758 days old. Please don't post here. Open a new topic instead.

Recommended Posts

In a system that tracks the service records for automobiles there are two tables (Automobile and ServiceVisit).  The operators of the system make notes about an automobile’s service visits each time a car is brought in for service.

The layout that the operator is working on while making visit notes is contextually based on ServiceVisits.  I’d like to be able to display the visit notes from the previous visit on the screen as the operator is making notes about the current visit.  I’d like to show in one glance what was done last time so the notes on the current visit are more thoughtful.

I guess I need a way to display the value of a field from the previous related record.  I’ve tried using a GetNthRecord construction on the Automobile records, but since operators will occasionally look at old service records and need to view what had been done on the previous visit building this on the Automobile level isn’t quite what I need…I think.

I’ve attached a prototype of what I’ve been playing with.  I’m not sure how helpful the prototype is, but thanks to the community for any suggestions or Comment.


Link to comment
Share on other sites

You need a self-join relationship of the ServiceVisits table, based on these predicates:


ServiceVisits::AutomobileID = ServiceVisits 2::AutomobileID


ServiceVisits::ServiceVisitID < ServiceVisits 2::ServiceVisitID


In the relationship definition, sort the records on the ServiceVisits 2 side by ServiceVisitID (or by date), descending.  That will make the immediately preceding visit the first related record - so you can just place any field from ServiceVisits 2 on the layout of ServiceVisits and it will display the data from the previous visit.

Link to comment
Share on other sites

  • 2 months later...

Hi Bruce...I seem to still be having trouble getting this to work properly.  The link to your file seems to have expired.  I wonder if I could get you to post it again?

Thanks so much!

​I reported this earlier today, see here http://fmforums.com/forums/topic/95785-broken-links-and-lost-files/#comment-440409

Edited by Lee Smith
Link to comment
Share on other sites

So Datalink, what happened when you tried Comment's suggestion?  Are you structured a bit differently so it did not work and if so, how are you structured?

Link to comment
Share on other sites

This topic is 2758 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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.