1 Reply Latest reply on Apr 20, 2012 10:15 AM by philmodjunk

    Differentiate a calculation depending on who is logged in

    StefanÖstlind

      Title

      Differentiate a calculation depending on who is logged in

      Post

      I have a database I want to share with my clients. This is the setup so far:

      T1) Company name and unique ID and Markup percentage.

      T2) Products with Products' ingoing cost and other information, including Selling Price.

      T3) Contacts, connecting to Company Account ID (T1), also includes a Online User Name that is equal to the account name

      Now, I want to have a layout that my client can view and see the contents of T2 but the field Selling Price must be calculated with the correct markup for that Company. Otherwise the product catalogue is the same.

      Being a bit new at this, I struggle to get the functions in a calculation and would so appreciate some help to get going.

        • 1. Re: Differentiate a calculation depending on who is logged in
          philmodjunk

          Get ( accountname ) can identify an individual user and get ( acccountprivlegesetname ) can identify groups of users.

          You thus can use such info to look up the ID of the user's company and put it in a global field or variable when the file is first opened. This will require either a field in T1 that lists a single account name or privilege set or you'd need a new, related table of account names for multiple users from the same company.

          Then your calculation can compute different prices based on the company. There's more than one way to do this. If Markup Percentage is the value that determines company specific pricing, you can put the company ID in a global field used in a relationship to match to a company record then your calculation can refer to the field via this relationship. When a user from a different company logs on, the relationship matches to a different record and a different selling price is computed.

          Your relationship might be:

          T2::gCurrentCompanyID = T1::unique ID

          and then your selling price calculation in T2 might look something like this:

          ItemCost * T1::Markup Percentage + ItemCost