AnsweredAssumed Answered

Finding, showing and counting related records when there are none.

Question asked by paulwatts on Aug 3, 2015
Latest reply on Aug 3, 2015 by richardsrussell

I have tables "Jobs" (parent) and "Job items" (child) and tables "Quotes" (parent) and "Quote items" (child). The Jobs family are related to the Quotes family via the "Client".

 

I want to be able to select a record in the Jobs layout and then, by script, find related records in Job items. I then want to be able to overwrite the Job items values (or create new), by script, using values from corresponding Quote items. There may already be some related Job items records (up to a max of 10) or there may be none. Problems arise when I try to count how many there are using Get(FoundCount).

 

1. If I use Go to related records to get from Jobs layout to Job items layout and there are no related Job items, the selected Jobs record remains the current record and Get(FoundCount) returns 1.

2. If I use Go to Job items layout followed by Find and there are no related Job items, all Jobs items in the table are shown and Get(FoundCount) returns thousands.

 

I need some logic that will leave me in the Job items layout with a Get(FoundCount) of either zero or other number (up to 10), as appropriate.

Any thoughts?

 

Paul

Outcomes