Forum Discussion

PatrickO_Neill's avatar
PatrickO_Neill
Qrew Member
2 years ago

Share Variables Between Formula / Global Variable

Hi,
Have a numeric formula, which is performing a number of calculations in order to determine an overall result. I must perform this calculation multiple times throughout the form with only minor changes to one of the calculations.
Is it possible to expose the variables that will not change, so they could be used throughout the App - making them a Global Variable.

Rgds
Pat

------------------------------
Patrick O'Neill
------------------------------

4 Replies

  • Yes definitely, there are three ways to do this which I will tell you for completeness but I only really recommend one or two of them. 

    The way that I don't recommend this to use something called application variables. I would leave you to look up the help text on your own for that but basically only an administrator can set these values and that is what's wrong with it. Regular users are not able to set the values.

    The way that I recommend which is simple to set up is that you create a table and have a single record in it. The table will be called something like Application Settings. 

    You put your settings fields into that table, creating any fields that you need there.  Since there is one and only exactly 1 record in the table the record ID will be of course 1. 

    Then on in the table where you need to draw in the values of those application settings do you set up a relationship to the application settings table where one application setting has many detail records and for the reference field on the right hand side of the relationship you can let Quickbase create a field initially but then rename the field to be called link to the application settings and change it to a Formula Numeric Field with the formula of 1.   Then just look up any of those application settings down to your child table.  Repeat the process for any other tables where you need the application settings.

    For completeness I will also tell you that you can also draw in those application settings using a formula query but the syntax for that is a little more advanced. The Advantage of that is you don't need to set up a relationship.



    ------------------------------
    Mark Shnier (Your Quickbase Coach)
    mark.shnier@gmail.com
    ------------------------------
    • PatrickO_Neill's avatar
      PatrickO_Neill
      Qrew Member
      Thanks Mark - will implement and test.

      ------------------------------
      Patrick O'Neill
      ------------------------------
      • DonLarson's avatar
        DonLarson
        Qrew Commander
        Strongly recommend Mark's solution for a table in the system.    I always name it Global Variables.

        ------------------------------
        Don Larson
        ------------------------------
    • JoelHickok's avatar
      JoelHickok
      Qrew Cadet
      I recommend Mark's solution, but would advocate that you do not necessarily need to create relationships between all the tables, as you can use the Query functions in the formula to query the values from Record ID# 1 in your settings table.

      ------------------------------
      Joel Hickok
      ------------------------------