User Request : Doing a Self-Lookup, that references record from the same form

James wanted to know:
How do I add a look-up field on a form that references records from the same form (i.e., in the same table).E.g., I have a form called Case and I wish to relate a specific Case to another Case in the same table so that I know they are related.Another example is that I have a People form and I wish to show that a person is related to another Person with a parent/child relationship.
So, here we go ……
Response:

  • We cannot use Lookup-field to reference data on the same form.

There is a workaround, and we will be using that instead.
Working DEMO here.

THE FORM

  1. Instead of a “Lookup field”, we will be using s a regular “Drop down field”
  2. Leave the default list-options as they are, we will not be using them
  3. Instead, we will be adding the “self-lookup-values” at run-time

THE CODE

  1. Using the “Aggregate Records” function, we will collect distinct values into a “list-variable”
  2. We now add these to the drop-down field


Hope this clarifies. Do let me know if you require additional assistance.

2 Replies to “User Request : Doing a Self-Lookup, that references record from the same form”

  1. Hi Deepa,
    Thanks for the tip. Unfortunately, I think it is missing a step. I need to first declare a variable and I am unsure how to do that. Can you help me? My form is Terms. I wish to look up other records in the Terms table on the Term field.
    In your example what is the form name, the field name and the variable name? You first needed to create the variable before you could aggregate it, correct?
    Thanks,
    James

  2. Hi James,
    Not necessarily, the aggregare record dialog box allows us to delcare a variable, choose form, and assign values as well
    Refere Scrnshot here

Leave a Reply

Your email address will not be published. Required fields are marked *