4 Replies Latest reply on Oct 28, 2015 12:46 PM by Hudi

    Using a global field in a relationship

    tays01s

      I'd like a simple relationship to populate a portal: Front::Unit = Patient::Unit. Unfortunately Patient::Unit needs to be a global field for other purposes and therefore the relationship doesn't filter records to only those Unit values chosen on the Front layout. I had thought to have Calc fields on Patient that update from the global fields, which they do, but they don't work in a relationship either.

        • 1. Re: Using a global field in a relationship
          user19752

          If Patient::Unit is global, the value is same in all records, portal become all or nothing.

          Then, change relation oerator to X from =. and apply portal filter as Front::Unit=Patient::Unit may be same result what you want.

          • 2. Re: Using a global field in a relationship
            Hudi

            The calculation is not working because it's unstored, therefore unindexable and cannot be used for the "child" part of a relationship.

            What I don't understand is why are you calculating from the global field? A global has the same value across all records.

            What's the scenario that would cause PATIENT::unit to be global? Seems odd that an attribute of patient would be the same across all patients.

            Anyway, I'd create another calculation field that only references fields in the same table, in your case PATIENT, so that the result is indexed and can be used as a "child" TO in a relationship.

            • 3. Re: Using a global field in a relationship
              tays01s

              The global field is required because it is a dropdown to select a specific value.

               

              user19752: I've tried the X operater, but as soon as I add the filter, all records disappear from the portal.

               

              Hudi: How does "create another calculation field that only references fields in the same table" differ from what I'd done? ie. a calc field that takes the global field's value.

               

              I have found a solution. The field from which the global field is originally set, is indexed and therefore works in the relationship. I've had to use a textbox to re-label the field's checkbox value; not neat but works.

              • 4. Re: Using a global field in a relationship
                Hudi

                I'm a little confused but as long as you got it working, great!

                The reason for not referencing the global field in your calculation is

                because that causes the calculation to be unstored. FM will not index a

                calculation result that uses a global value.

                 

                Cheers