How do you show an image on a form from a related table?

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered
I have a table _DBID_PROJECTS that contains projects. I have a separate table _DBID_DOCUMENT_REPOSITORY that contains various documents and photos with an attachment field (FID: 6) . The two tables are related - one project has many documents.

My question is: How do I get a project image from the document repository table to display on a form in the projects table? I've tried a formula-text field, but the formula isn't working. Any help would be appreciated. 
Photo of Kaeli

Kaeli

  • 52 Points

Posted 2 years ago

  • 0
  • 1
Photo of Matthew Neil

Matthew Neil

  • 31,438 Points 20k badge 2x thumb
I just did this about 15 seconds before you asked the questions, what are the odds.

You will need to decide which image you want to show and get that Record ID# summarized to the parent record.

So if you have some qualifying field on the Documents table that says what type of file is attached, it will be much easier.

Say you have document type of "Photo";  Create a summary field where you are summarizing the ""Minimum" Record ID#, with the condition that "Doc type" is equal to "Photo".

Call it something like [Minimum Photo Record ID#]

Then use this formula in your formula text field on the Projects table.

"<img height=\"80\" src=\"" & URLRoot() & "up/" & [_DBID_DOCUMENT_REPOSITORY] & "/a/r" & [Minimum Photo Record ID#] & "/e6/v0\" />"
Photo of Kaeli

Kaeli

  • 52 Points
Thank you, this is EXACTLY what I needed! Worked like a charm! I'd never created a summary field before, but it was pretty straightforward and easy. Thanks again!