3 Replies Latest reply on Jul 16, 2013 8:44 AM by philmodjunk

    Set portal container repetition based on another field's value

    Ooglethorpe

      Title

      Set portal container repetition based on another field's value

      Post

           This should be so easy but I don't know why I'm having so much trouble.

           I have a container field with 5 reps. First is blank and then the remaining four have icons representing different leaves of absences. (ie. Vacation Leave, Sick Leave, Medical Appointment, Earned Day Off)

           I also have another field called SummaryLeave where you pick from these four absence types, so the value will either be blank or one of these four.

           I have all of this in a portal set to display the upcoming leaves of absences for the next seven days.

           All I want to do is have a calculation that evaluates whether SumaryLeave is blank and if not, which of the four is selected and then tell the container field in that portal row to display the appropriate image (repetition).

           My scripting knowledge is certainly not expert but I'm not a novice either, I just can't figure out whether I should have calculations on the container field, or on a portal's tab, or possibly have another container field which displays the results of the calculation or I guess, whether I even have my script calculation written correctly.

           Any help is appreciated.

        • 1. Re: Set portal container repetition based on another field's value
          raybaudi
               You'll need a calculation field, result container ( one repeatition ) with calc:
                
               Case( 
               SummaryLeave = "Vacation Leave" ; gContainer[2] ;
               SummaryLeave = "Sick Leave" ; gContainer[3] ;
               SummaryLeave = "Medical Appointment" ; gContainer[4] ;
               SummaryLeave = "Earned Day Off" ; gContainer[5] ;
               gContainer
               )
                
               where gContainer is the name of your container field ( five reps ): it must be global or related
          • 2. Re: Set portal container repetition based on another field's value
            Ooglethorpe

                 Thanks, interesting. In this example are you saying that the container field that contains the images is set to be global and that when the case statement returns true it'll show up even when in a portal?

                 I was able to solve this but my solution isn't as good as this would be. I ended up making a new table just to hold these icons and then put a calculation on the container field appearing in the portal that did this:

                  

                 Case (
                 SummaryLeave = "Vacation Leave" ; GetRepetition ( LeaveIcons::LeaveIcons ; 1 ) ;
                 SummaryLeave = "Sick Leave" ; GetRepetition ( LeaveIcons::LeaveIcons ; 2 ) ;
                 SummaryLeave = "Sick Leave - Family" ; GetRepetition ( LeaveIcons::LeaveIcons ; 3 ) ;
                 SummaryLeave = "EDO" ; GetRepetition ( LeaveIcons::LeaveIcons ; 4 ) ;
                 SummaryLeave = "EDO - Swap" ; GetRepetition ( LeaveIcons::LeaveIcons ; 5 ) ;
                 SummaryLeave = "EDO - Fell On Stat Holiday" ; GetRepetition ( LeaveIcons::LeaveIcons ; 6 ) ;
                 SummaryLeave = "Appointment" ; GetRepetition ( LeaveIcons::LeaveIcons ; 7 ) ;
                 SummaryLeave = "In Later" ; GetRepetition ( LeaveIcons::LeaveIcons ; 8 ) ;
                 SummaryLeave = "Leaving Early" ; GetRepetition ( LeaveIcons::LeaveIcons ; 9 ) ;
                 SummaryLeave = "Educational Leave" ; GetRepetition ( LeaveIcons::LeaveIcons ; 10 ) ;
                 SummaryLeave = "Statutory Holiday" ; GetRepetition ( LeaveIcons::LeaveIcons ; 11 ) ;
                 SummaryLeave = "Delivery" ; GetRepetition ( LeaveIcons::LeaveIcons ; 12 ) ;
                 )
                  
                 I'm definitely going to try your solution though. Far shorter and less involved.
                  
                 Thanks.
            • 3. Re: Set portal container repetition based on another field's value
              philmodjunk

                   You also have the option of setting up a related table of LeaveIcons with one icon in the container field of each related record. You can then use your SummaryhLeave field as a match field to match to the related record with the appropriate icon.

                   Then you simply place the container field from the related table of leave icons directly in your portal row--no calculation field required.