4 Replies Latest reply on Jan 29, 2017 4:42 PM by Malcolm

    How do you Specify the Context for a Get Function?

    Malcolm

      Many of the help pages for Get functions include the following note:

       

      Notes

      If you specify the context for the current calculation, this function will be evaluated based on that context; otherwise, it will be evaluated based on the context of the current window.

       

      How do we specify the context?

       

      Malcolm

        • 1. Re: How do you Specify the Context for a Get Function?
          BowdenData

          In the calculation dialog box at the top (highlighted in screenshot). I have rarely changed this from what I call the default of the base table name. I have done it in the past, but can't recall any specific examples though.

          Calculation_Context_Switcher.png

          • 2. Re: How do you Specify the Context for a Get Function?
            philmodjunk

            It depends one where you are using the get function. This is something that could be part of a calculation that is used in:

             

            1. A field's definition (calculation field or auto-entered calculation)
            2. a conditional format or Hide Object When expression
            3. A script step
            4. A record level Access expression in Manage | Security

             

            1 and 4 rely on the Context drop down mentioned by BowdenData. 2 and 3 rely on the context of the layout and record that is current at the time the expression evaluates.

             

            In all cases, "context" is determined by a "Table Occurrence". That's what we call the "boxes" found in your relationship graph. Every layout specifies a table occurrence in "show records from" in layout setup and is listed to the right of "Table:" in the status tool bar when the layout is in Layout Mode. The "context" drop down in the calculation dialog is also used to select a Table Occurrence.

             

            But most Get functions return a value that has little or nothing to do with the current record or any specific table occurrence. The system's time and date, for example will be the same in all such contexts.

            1 of 1 people found this helpful
            • 3. Re: How do you Specify the Context for a Get Function?
              Malcolm

              BowdenData Thanks for solving that mystery. I was thinking that the context would always be given by the current TO or it could be provided by a portal TO. I'd forgotten about the context selector available in some calculation dialogs.

               

              malcolm

              • 4. Re: How do you Specify the Context for a Get Function?
                Malcolm

                philmodjunk wrote:

                 

                most Get functions return a value that has little or nothing to do with the current record or any specific table occurrence. The system's time and date, for example will be the same in all such contexts.

                The other thing is that, even though the functions say they are context-sensitive it is hard to see how we can adequately describe context using the context selector.  Within a single file, the Get(CurrentExtendedPrivileges) would not vary, no matter which TO was being used as the context for the evaluation. It would only vary from window to window in a multi-file solution. Get(RecordAccess) could conceivably change value, depending on the TO.

                 

                Malcolm