7 Replies Latest reply on Sep 21, 2014 9:22 AM by philmodjunk

    Conditional FIlter portal setup

    ultranix

      Title

      Conditional FIlter portal setup

      Post

      Hey, I'm trying to setup conditional filter portal, i.e. I have two global fiels: PAY::xaction_type and PAY::xstatus and I want only those records to appear, that meet criteria corresponding to those fields.

      I created a portal, which is based on Table OBJECT_Pay with filter calculation:

      If (IsEmpty (PAY::xaction_type); OBJECTS::contract_action = "*"; OBJECTS::contract_action = PAY::xaction_type) &
      If (IsEmpty (PAY::xstatus); OBJECTS::status = "*"; OBJECTS::status = PAY::xstatus)

      But it doesn't work. My idea here would be if PAY::xaction_type (or PAY::xstatus) is empty, then it wouldn't filter by that field and show all records, and when either one or both fields have values, then it would filter by them. How do I achieve that?

        • 1. Re: Conditional FIlter portal setup
          philmodjunk

          &--concatenation operator for gluing text strings together cannot be used as the logical operator: AND.

          OBJECTS::contract_action = "*"

          Will be true only if contract_action is a field of type text and the text in the field is exactly one asterisk (can't use wild cards here like you can in a find request.)

          Try

          IsEmpty (PAY::xaction_type) Or IsEmpty (PAY::xstatus) Or OBJECTS::status = PAY::xstatus

          Portal filters are Boolean (logical) expressions that are evaluated once for each related record that might appear in the portal. If it evaluates as "True", the record is displayed in the portal. If it evaluates as "False" the record is omitted from the portal.

          • 2. Re: Conditional FIlter portal setup
            ultranix

            action_type and status contain different kinds of information. action_type is: sell, lease, search. status is: active, cancelled, done.

            1. So, for example, if I leave xaction_type empty and set xstatus to "Active", i would like to see all contracts (sell, lease and search) that are set to active.

            2. Another example - If I leave xstatus empty and set xaction_type to "Sell", I would like to see all contract (active, cancelled, done) that have action_type set to "Sell".

            3. If i leave both xaction_type and xstatus empty, I would see all possible contracts in the portal with any type of action and any status.

            What would be universal calculation for Filter portal in such case?

            • 3. Re: Conditional FIlter portal setup
              philmodjunk

               ( IsEmpty (PAY::xaction_type) And  ) Or // 3
              ( IsEmpty (PAY::xaction_type) and OBJECTS::status = "Active" and PAY::xstatus = "Active" ) Or // 1
              ( IsEmpty (PAY::xstatus) and PAY::xaction_type = "Sell" ) // 2

              • 4. Re: Conditional FIlter portal setup
                ultranix

                it doesn't work :\

                • 5. Re: Conditional FIlter portal setup
                  philmodjunk

                  "It doesn't work" is too vague for me to offer any suggested changes. Exactly HOW doesn't it work?

                  • 6. Re: Conditional FIlter portal setup
                    ultranix

                    I will explain it later.

                    Here I need another thing. I have picture, that is originally 800x536. The container field that I have (icon or thumbnail, whatever you may call it) dimmensions are 30x30. I tried it to reduce that 800x536 to 30x30 without "stretching", but i couldn't. 1-crop to frame is no good, 2-reduce image to fit is best, but it streches image 3-enlager image to fit - no good, 4-reduce or enlarge image to fit is good, but again image is streched.

                    What I would like to - reduce image to 30x30 while maintaining the proportions, and cut not top and bottom (as width is filled, but top and bottom is cut),  but cut left and right sides, while maintaining top and bottom. Is there a way to do so?

                    I added a picture.

                    • 7. Re: Conditional FIlter portal setup
                      philmodjunk

                      Are you using FileMaker 12 or newer?

                      If so, you might try combining the GetThumbnail function with a Crop to Fit setting to get this result. I think that will work for you.