File Attachment field as Lookup Field

  • 0
  • 1
  • Question
  • Updated 8 months ago
  • Answered

Does anyone have any suggestions for simple ways to either display or link to a File Attachment on a parent record within the child record?

We have a parent table of procedures, which has a file attachment field of documentation. We have a child table of issues, where the resolution could be to select one of our common procedures to follow from a drop down list of all procedure records.

I would like to do this so the file attachment can be accessed directly from the child record without increasing the number of clicks from linking to procedures then into the file attachment or making a many to many relationship between the table and having to have extra steps to set up the links in the first place.

Photo of Paul

Paul

  • 30 Points

Posted 5 years ago

  • 0
  • 1
Photo of Xavier Fan

Xavier Fan, Champion

  • 570 Points 500 badge 2x thumb
I've created an example app in Exchange - called "Example - Lookup File Attachment through Many-to-Many Relationship". You can find it here:


https://www.quickbase.com/db/main?a=AppDetail&ID=1439&app_name=Example%20-%20Lookup%20File


There are 3 tables:
- Procedures - with a File Attachment field
- Issues
- Resolutions - the intermediate table in the many-to-many relationship between Procedures and Issues.

The basic set up for a Many-to-Many relationship is detailed here:
http://www.quickbase.com/user-assistance/Default.html#many_to_many_relationship.html

You cannot lookup a File Attachment field directly.
To enable a lookup to the File Attachment field (in the Procedures table) - create a Formula Text field (called "File Attachment Link" here, with HTML tags enabled) with this formula:

If ([File Attachment] = "", "",
"<a href='" & URLRoot() & "up/" & Dbid() & "/a/r" & [Record ID#] & "/e7/v0' target='_blank' >" & [File Attachment] & "</a>")

Note the "e7" portion of the formula. The "7" refers to the Field ID of the File Attachment field. Modify accordingly for your own app.

This "File Attachment Link" link field can now be looked up in the Resolution table, and also on the Issues table.

In the example app - see that Procedure A is the Resolution for Issues 1 and 2 - with the same Document A accessible from both. Procedure B is the Resolution for Issue 3. Issue 4 is resolved by both Procedure A and Procedure B.

The only real additional step in setting the relationship (on top of a normal many-to-many relationship) - is setting the File Attachment Link field. Once you have that - you can look it up normally.

So once you're in the Issue, you press "Add Resolution", and select the Procedure. Then on the Issue, you can now see the File Attachment Link for that Procedure, which you can click directly to download the document.

Hope this helps!

This conversation is no longer open for comments or replies.