Searching For Records via Relationship

Hello!

I’m still working through years of FileMaker logic… so here’s my problem.

I have 2 tables,

items
items_count

A relation is defined to be items_to_items_count using a pk and fk.

Using Servoy code, I’m trying to search for all Items that have a record in the items_count table with the field count >= 1.

So, I’m doing this:

form.items.controller.find()
form.items.items_to_items_count.count => 1
form.items.controller.search()

When I run it this way, the search doesn’t pull up the correct records, in fact it appears to find all records in the items table… including records that do not have a related items_count record.

If I build this search in SQL, it comes out with the right amount of records.

Why is my servoy code failing?

Hi Chico

I think this should work for you.

form.items.controller.find();
form.items.items_to_items_count.count = “>1”; // or “>0” or “>=1” not sure which you want, also the field “count” must be stored
form.items.controller.search();

when you have text characters in a search (in this case “>”) you will need to use quotation marks.