4 Replies Latest reply on Feb 1, 2011 9:35 AM by philmodjunk

    RELATED TABLES

    andreapp

      Title

      RELATED TABLES

      Post

      HI!

      I'm trying to manage a Database with different tables related. I would like to have a main table with all my contacts and the same information in different tables by one category. I mean:

      TABLE 1_ DATABASE : suppliers, clients and freelances' details

      TABLE 2 _ FREELANCE: just the records which contents the category FREELANCE

      TABLE 3_ SUPPLIERS: just the records which contents the category SUPPLIER

      TABLE 4_ CLIENTS: just the records which contents the category CLIENT

      Is it possible??? Can anyone help me?

      Thanks

        • 1. Re: RELATED TABLES
          Abhaya

          Hello andreapp,


          OK  I think it is possible
          Make  table Contact
          here u enter all the information.
          make 3 additional table named as CLIENT,FREELANCE,SUPPLIER.
          then write a script

          if category=CLIENT
          then
          go to CLIENT layout
          Set field(target field name;Lookup ( sourceField {; failExpression} ))
          go to original layout

          if category=FREELANCE
          then go to FREELANCE layout
          Set field(target field name;Lookup ( sourceField {; failExpression} ))
          go to original layout

          if category=SUPPLIER
          then go to SUPPLIER layout
          Set field(target field name;Lookup ( sourceField {; failExpression} ))
          go to original layout





          Here set field step must be written how many field values you want to store in separate tables.

          After  this just go to layout setup and attach it on record commit trigger.

          keep source field  = Main table corresponding field


          • 2. Re: RELATED TABLES
            philmodjunk

            It's possible, but likely not the most efficient way to do this. Why do you want separate tables for this instead of using a category field to identify the category to which a given contact belongs?

            • 3. Re: RELATED TABLES
              andreapp

              I do have the category to identify them. The thing is I have designed different layouts for each category. I'd like to have a list with all the contacts and then different layouts depending on the category.

              Sorry if I don't explain it better, I'm a beginner

              • 4. Re: RELATED TABLES
                philmodjunk

                Keeping all the records in the same table gives you options that you will lose if you split your data into separate tables.

                You can have your different layouts but still keep the data in a single table. All te layouts can refer to the same table even though they are designed to specifically work with a particular category. Simply perform a find for all records appropriate for that layout's category. This can be automated with a script trigger if you like. Another script trigger can constrain found sets to a specified category if you need to allow users to perform finds and don't want them to find records from another category.

                It also be possible to design a layout where its appearance changes to match the category of the current record. If these are form view records, that approach, if possible, would save you the trouble of maintaining such a series of different layouts.