What is happening is that the report always is displaying a photo whether or not it is a "Printing" photo.
What do you want your script to do?
I see nothing in your script that selects a specific photo record on your photos layout (it could just as easily by based on Photos as Photos 2 for this purposes--both are different occurrences of the same table.)
Try it this way:
Set Variable [$ID ; value: Items::Item Record ID]
Go to Layout [Photos]
Enter FInd mode 
Set field [Photos::Related item record id ; $ID]
Set FIeld [Photos:: Photo type ; Items::g photo filter ]
Thanks for you input. I've been trying it out and realize I wasn't specific enough.
My layout contains fields from ITEM and the associated child table PHOTO. The layout is based on ITEM.
Item::Item record id --- Item::Item description --- Photo::photo
Every single ITEM record must appear on the layout whether or not it has an associated child PHOTO record.
If there is a "printing" PHOTO I want it on the layout. If there isn't a "printing" photo then that space on the layout should be blank.
So I get an error if I try your find because the Photo::photo type field isn't on the layout.
Conceptually what I need to do is
- once on an ITEM record do a find for a child PHOTO record of the type "printing" and display the ITEM fields and PHOTO.
- If there aren't any associated child PHOTO records of type "printing" display the ITEM fields and nothing in the PHOTO space.
- If there aren't any associated child PHOTO records of any type, display the ITEM fields and nothing in the PHOTO space.
You don't need to find anything in the PHOTO table. If you are on a layout of the ITEM table, any find you perform in the PHOTO table has no significance.
Looking back at your original post, your script should work fine for your stated purpose - except for two things:
Set Field By Name [Item::g photo filter;"Printing"]
Change that to:
Set Field [Item::g photo filter;"Printing"]
You say that "The layout is based on ITEM" - but your script says that the layout is based on Photo2.
Hmmmm. Got it working. Does exactly what I wanted - display every item and include a photo if there is one of the type "printing".
I have a second relationship (PHOTO2) between ITEM and PHOTO based on record id and photo type.
My layout has fields from ITEM and the image itself PHOTO2:IMAGE.
My script says ---
Set Field[Item::g Photo Type;"Printing"]
Go to Layout [Items with Photo(Item)]
Show All Records
Am not quite sure why it is now working but it is. I did correct the record the layout was based on,
changed Set Field by Name to Set Field, and made sure the image field was PHOTO2:IMAGE.
THANK YOU and PHIL very much for the additional information. Though my final solution isn't what he
suggested, by puzzling through his suggestion and your specifics I was able to see flaws in the original.