2 Replies Latest reply on Aug 3, 2010 4:48 PM by rowing190

    Defining a container field



      Defining a container field


      Please bear with me as I do not have much in the way of writing calculations. Here is my query.

      Our database has two sets of fields for company addresses - one set of address fields is for the company's physical address; the other set of address fields is for the company's p.o. box. The company may have both a physical address and a p.o. box, only a physical address, or only a p.o. box.

      For mailing purposes, I would like to create a third set of address fields. My thoughts are that the third set of address fields would be container fields, but I do not know how to specify the correct calculation.

      Here is the logic for which I am trying to write a calculation.

      I have three fields - address 1, p.o. address 1, mailing address 1 (this is the container field to be created)

      If p.o. address 1 = not blank, then mailing address 1 = p.o. address 1

      If p.o. address 1 = blank, then mailing address 1 = address 1

      Thanks for anyone who can help with this problem. rowing190

        • 1. Re: Defining a container field

          You would not use a container field for this purpose. You can create s series of calculation fields that use the logic you describe to return the desired address data. You could also put these addresses in a related table and define a relationship that will return the desired address field via the relationship.

          Using calculation fields:

          If you have two fields named StreetAddress and POBox, your calculation would look like this:

          If ( IsEmpty ( POBox ) ; StreetAddress ; POBox )

          You can define one such calculation field for each such pair of fields that make up part of your address information.

          In a relationship, define a new table, called Addresses, with the following address fields:

          AddressType (put either "Street" or "PO" in this field for each record)

          Link it to your existing table like this:
          Company::CompanyID = Addresses::CompanyID

          Define a sort order on the relationship that sorts the records by AddressType in ascending order.

          Now you can show both addresses on your company layout in a portal to addresses, but if you just put the address fields from this table directly on a company layout, You will see the PO Box address if one exists and the street address if a PO Box address does not exist.

          • 2. Re: Defining a container field


            Thanks so much for your help. The calculation that you provided worked wonderfully.