Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Container Question


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

Recommended Posts

Posted

Not sure if this is should fall under layout queries... but here goes....

I have a join table in place that brings together 2 tables.

One table is items... the other table is images.

I scripted a way for people to link items to images. They can have multiple links, or an image can have multiple items... (the benefit of the join table)

That has been working great.

But what I need now is a way to denote a primary image. I am a little lost on how to proceed with this.

When viewing the images as a single field (not a portal) it will display the top image only. This is fine... but how could I give tell Filemaker, which image should appear on the top.

Anyone know a way for an image always to appear as the top one? Remember.... I am not using a portal... just a single field... so I am expecting only one image to show up... I just want it to be the correct one.

Posted

I can think of a couple ways to do this. You could have a "mark" field in the join table, a Number field, formatted as a checkbox, with a Value List of 1 only; so it's 1 or nothing.

You would also need a "constant" field in the main table, calculation, number result, 1 (that's all; I call these z_c1).

Then create a new relationship, same as existing, but adding the above, from z_c1=::Mark

Use that for the "chosen" image. You would need to put that "mark" field in the portal of the record's multiple images (or however you're looking at them). The one glitch to this method is that there can only be 1 marked for the parent. This can be done via Validation (ugly), or a script that goes thru and clears any existing mark for the parent's images upon clicking the checkbox to "on"; or they could just pay close attention :-]

Another way would be have a "chosen image's ID" field in the parent table. When you clicked on an image in a portal of multiple images, its unique ID* would be put into the parent table's field. Then the chosen image is just the last one you clicked on. This method has the advantage that there can only be 1, so you don't have to worry about someone clicking more than one.

*This could be a random UID field, generated by a calculation or Custom Function, so you don't need to maintain/update it. I use Ray Cologan's:

http://www.nightwing.com.au/FileMaker/demos9/demo910.html

Posted

Fenton,

Thanks for the response. I think I follow what you are saying... but before I proceed, I have a couple of questions...

Will I need to create a calculated container to display the primary one marked?

Also... you said something about creating a "constant" variable, calculation, result, 1

Why set this as a calculation when it could be just a number? Is there something I am missing about that?

Posted

1. No, it's a dedicated relationship, which will only match 1 record in the images, as it is:

ParentID=::ParentID AND chosen ImageID (unique)=::ImageID

So you show it like you do now, via a relationship, but use the above new relationship (but keep the usual ParentID=::ParentID relationship, as it is needed to see/count/go to them all sometimes).

2. Doesn't really matter. Some people auto-enter 1, some calculate it. I'm of the calculate it school. No particular reason why.

This topic is 5489 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.