5 Replies Latest reply on Jun 17, 2011 10:09 AM by philmodjunk

    I need 3 fields to display data only if that record is "True"?

    j_rameses

      Title

      I need 3 fields to display data only if that record is "True"?

      Post

      I have a layout that will display data only from several tables.

      I have three fields that needs to pull the data only if its value is "True" or "1", it is a checkbox selected for Primary.  There is data elsewhere in a portal that has several records per client.  I need for only the data that is selected with the checkbox for "Primary" to display the data.  I tried several methods but they do not work.  I tried to do a Set Field but that only returns an error that the field is not modifiable.  How do I go about on displaying this preferred data?

        • 1. Re: I need 3 fields to display data only if that record is "True"?
          philmodjunk

          A bit more detail would help us to help you.

          You appear to have at least two tables with the records from table 2 displayed in a portal. (I know you have more tables, but we seem to be dealing with just two here for this problem.)

          How are they related.

          You then want to use a number field to control which records appear in the portal, correct?

          Is this a number field defined in the portal's records or in the table on which the layout is based?

          Do you want this as a permanent filter on the portal (Portal only shows related record where field is true) or is this something you want to turn on and off. (Select 1 by clicking a check box and records in the portal are filtered to only those with 1. Clear the check box and all related records are displayed.)

          • 2. Re: I need 3 fields to display data only if that record is "True"?
            j_rameses

            We have a portal that keeps the history of medications and its misc. data pertaining to it.  When a medication is current there is a checkbox in the portal where the user clicks on.  The portal is from  "Clients_Medication".  That is the occurrence.  The checkbox field name is called "cc_IsMain".  I have a different layout that in there I want to display the data of three fields if that current medication has a checkmark next to it.

            The occurrence is from two tables :"Clients" & "ClientsMedications".

            The relationships are: "_kf_ContactID" to "_kf_ClientContactID" & "g_Factor" to "Type"

             

            • 3. Re: I need 3 fields to display data only if that record is "True"?
              j_rameses

              Then there is an occurrence from "Clients_Medication" to Clients_Medication_Products"  with a relationship of "_kf_ProductID" to "__kp_ProductID".  Then this occurrence goes to another called "Client_Medication_ProductsWithSameName" with a relationship of "ProductName" to "ProductName"

              • 4. Re: I need 3 fields to display data only if that record is "True"?
                j_rameses

                I have one way to make it work but it is cheating.

                I made it to work by putting it in a portal and making the sort order descending by "cc_Main".  Then I only chose to display only one record in the portal.  This seemed to work since there can only be one record thatis active.  I do not know if that is proper coding.

                • 5. Re: I need 3 fields to display data only if that record is "True"?
                  philmodjunk

                  While the purpose of the ContactID fields in your relationship is fairly obvious, the purpose to using g_factor and Type are not. Is g_Factor a global field?

                  Speaking just in general terms, there are two ways to set up a portal that will list all related records, but only those with 1 in a number field in the related record:

                  1) If you have FileMaker 11, you can specify a filter expression for the portal: PortalTableOccurrence::CheckBoxField = 1

                  2) If you do not have FileMaker 11 or wish to establish this relationship at the data level (can make some calculations easier to work with):

                  Set up your portal relationship to include the checkbox field as part of the relationship. On the parent table's side of the relationship, use a calculaiton that always returns the same value to serve as the filter. This might look like this for your portal, but I'm still fuzzy as to whether this is the right set of tables and fields for your portal:

                  Clients::_kf_ContactID = ClientsMedications::_kf_ClientContactID AND
                  Clients::constOne = ClientsMedications::CheckBoxField

                  Define constOne as a calculation field and enter just the number 1 or the word True as it's calculation. (Chose Number as its return type.)