Passing values to subform (form within form)

I have a Lab Inspection form. When creating a new Lab Inspection, you can mark items from a list as “Unsafe”. Each of these Unsafe items needs an issue created. I’ve created a Ref column that allows issues to be created. I’d like to pass the “Unsafe” values to that form so that users can only create issues from items marked “Unsafe”. Is this possible?

Inspection Form:

When you click “New” to add an issue, you get to this form:

I tried this expression. I put this is the Valid_If for the Issue > Issue Type field (which should be filtered to only include “Unsafe” items from the Inspection form). Unfortunately, this yields no results.

SELECT(Lab Inspection Issue Type[Key], 
            IN( [_THIS], SELECT(Lab Inspection[Unsafe], [Key] = [_THISROW].[Lab Inspection]))
      )

And here are the columns. For the Lab Inspection Issues (“Issue Type” is the field that needs to be filtered):

And for Lab Inspections (“Unsafe” are the items of interest, “Related Lab Inspection Is” is the virtual column to hold related issues):

Thank you for the details. However you may wish to elaborate how issue types options are populated in parent table “Lab Inspection”. The [Unsafe] Enumlist column seems to have some formula. Are these columns [Safe] and [Unsafe] referenced from the “Lab Inspection Issue Type” table?

Also “lab Inspection Issue” table has two reference columns. Could you update how the [issue Type] reference column is populated? Is this also referenced from the “Lab Inspection Issue Type”?

If the [Safe], [Unsafe] in “Lab Inspection” and [issue Type] in " Lab Inspection Issue" are both referenced from the third table" Lab Inspection Issuet Type" table , then I believe in the valid_if of [Issue Type] in the " Lab Inspection Issue" table, you could try an expression of [Lab Inspection].[Unsafe]

2 Likes

Thanks, Suvrutt. Simply using [Lab Inspection].[Unsafe] worked!!!

For anyone who may want more info in the future, I’ll go ahead and answer your questions.

Issue types are pulled into the [Safe] and [Unsafe] columns as Ref:

Anything not selected in [Safe] is automatically entered as [Unsafe], as documented here.

For the “Lab Inspection Issue” table, the [Issue Type] column is populated directly as Ref:

The Valid_If statement, which currently gives an EMPTY result, is:

SELECT(Lab Inspection Issue Type[Key], 
            IN( [_THIS], SELECT(Lab Inspection[Unsafe], [Key] = [_THISROW].[Lab Inspection]))
      )
1 Like