5 Replies Latest reply on Jan 14, 2016 5:14 AM by disabled_morkus

    Finding previous related record

    tkemmere

      Dear all,

       

      Again something I never did before, and wondering how to.

       

      I have a table with houses and a related table with electricity readings. One house can have more readings over time. Of course there are many houses. And the readings are added off and on in random order to different houses, and sometimes deleted. The readings table has an ID auto increment unique number. And a House-forreignn-key. (I call it FIDHouse).

       

      In the layout for adding a new reading, I would like to make a button "Copy end-reading from previous". Cause if it exists, I'd like to automate it, to save time and prevent mistakes.

       

      But how do I tell Filemaker to "Go to the previous record that belongs to this house"? And then "Set variable Reading and Reading date" so I can "Set field"s in my current record?

       

      I was thinking of Looping with the ID reducing one by one until there is a FIDHouse-match. But someting tells me there must be an easier way.

       

      Thanks for the advice. Regards, Thomas.