2 Replies Latest reply on Mar 7, 2013 11:43 PM by noraheuer

    Value List based on Calculation field not working as expected

    noraheuer

      Title

      Value List based on Calculation field not working as expected

      Post

           I have 3 tables.

           Customers: (ID, Name)

           Domains: (ID, Name, CustomerID, hasEmail, emailOn)

           Emails: (ID, Name, DomainID)

      Relationships:

             
      •           Customers::ID => Domains::CustomerID
      •      
      •           Domains:ID => Emails:DomainID

      Field Setup:

             
      •           ID (Serial values)
      •      
      •           Name (Text)
      •      
      •           hasEmail (Number - boolean checkbox)
      •      
      •           emailOn (Calculation => If ( hasEmail ; 1; 0 ))

      Valuelist "DomainsByCustomerWithEmailOn" setup:

             
      •           Use Values from Field
      •      
      •           1st field "Domains::emailOn", 2nd field "Domains::Name"
      •      
      •           Include only related values starting from "Customers"

      Customer Layout setup:

             
      •           not editable ID field
      •      
      •           text field for Name
      •      
      •           Tab control for Domains and Email
      •      
      •           Domain Tab has a portal showing textfield for domain name and checkbox for hasEmail
      •      
      •           Emails Tab has portal showing textfield for username and a popup menu on field DomainID using Valuelist DomainsByCustomerWithEmailOn

      Expected Behaviour:

           The Domain Name field on the Email tab will show a popup list containing all the domain names that have the box "hasEmail" checked.

      Actual Behaviour:

           The Domain Name field on the Email shows all domain names associated with a given customer ignoring the "hasEmail" setting completely.

      What am I missing?

           Looking at the Domains table in Table View (see below) shows that the emailOn calculation works, so why is the valuelist generating a listing of all domain names while being based on that field?

            

      Screen_Shot_2013-03-08_at_12.58.jpg

        • 1. Re: Value List based on Calculation field not working as expected
          noraheuer

          enlightened

               The problem appears to be related to:

                

                

          Valuelist "DomainsByCustomerWithEmailOn" setup:

                 
          •           Use Values from Field
          •      
          •           1st field "Domains::emailOn", 2nd field "Domains::Name"
          •      
          •           Include only related values starting from "Customers"

                

               If i only show values from the 1st field it works as expected. It looks like the 2nd field values are not really selected by a lookup, but are added to the list. I suppose I need a different approach to achieve my objective.

          • 2. Re: Value List based on Calculation field not working as expected
            noraheuer

                 yep. 

                 In the Domains table i renamed the emailOn field to "emailOnID"

                 I added another calculation field "emailOnName" => ( If ( hasEmail ; Name; "" ))

            I then modified my Valuelist to use emailOnName as the second field.

            Problem solved.