10 Replies Latest reply on Aug 25, 2014 8:30 PM by keywords

    Hide object when field contains either of two words

    Jesse_Wright

      Hi all,

       

      I'm trying to hide a graphic in a menu system for a FM Go 13 solution. It's such a tiny detail that is visually appealing but not critical, but I can't seem to let this go because I can't figure it out. Hopefully some of you can help me put this to bed!!

       

       

      It is a cascading value list - where the user enters a field on the form, script trigger opens a new window and switches the layout to a list of values. If the value has a subset of values to list, I am using a right arrow .png as a graphic to indicate that the value list will expand again to a second list for a selection.

       

      I have used a few different methods in the past. Conditional masking, Conditional formating of a text block ">", or the Text in the field it self has an > at the end " Apple >"

       

      With the new Behavior options in FM13, I was hoping to use it to hide a graphic and give the layout a little more candy

       

       

      To explain:

       

      Say the list is for Fruit:

       

      Apple

      Orange

      Grape

      Kiwi

       

      Lets say Apple and Grape have a second list of values for FruitColor, so I want to indicate that there is a second selection to be listed.

       

      Using Hide object when on the graphic, I know the following works for one value:

       

      Hide object when: FruitType::Value ≠ "Apple"


       

      I get the list showing the right arrow graphic visiable next to Apple correctly, as it should.

       

      Apple >

      Orange

      Grape

      Kiwi

       

      With "Hide object when" I can get it to hide the graphic on all but the one text value I specify, but on this list I have two items that have a second list of values, but I can't think of how to make the expression evaluate the two items.

       

      So the expression would be hiding everything unless the field contains "Apple" or Grape" so I get a list that looks like:

       

      Apple >

      Orange

      Grape >

      Kiwi

       

       

      To start I know the following works for one value:

       

      Hide object when: FruitType::Value ≠ "Apple"

       

      I get the list showing the right arrow graphic visiable next to Apple, as it should.

       

      Apple >

      Orange

      Grape

      Kiwi

       

       

      Here is where I'm festering...I can't think of how to tell it to evalute a second text value. I want the calculation to include both "Apple" and "Grape" so all the graphic are hidden in the list except next to Apple and Grape.

       

      So I thought the expression just needed an "or" operator:

       

      FruitType::Value ≠ "Apple" or FruitType::Value ≠ "Grape"

       

      It just returns the list with no graphics. I would have expected that result with xor, so maybe I don't fully understand how to use the operators, or the calculation for Behavior will not evaluate the expression past the operator.

       

       

      I made a quick demo to work with. See attached:

       

      Thank you in advanced!!


      Best,

      Jesse

        • 1. Re: Hide object when field contains either of two words
          ErikWegweiser

          Hi, Jesse: Is what you're trying to do simply a matter of using "and" instead of "or" ?

           

          ( FruitType::Value  ≠ "Apple" ) and ( FruitType::Value  ≠ "Grape" )

           


          1 of 1 people found this helpful
          • 2. Re: Hide object when field contains either of two words
            beverly

            Look at the FilterValues() function and see if that helps.

             

            -- sent from myPhone --

            Beverly Voth

            --

            • 3. Re: Hide object when field contains either of two words
              raybaudi

              Use:

               

              IsEmpty ( FilterValues ( Fruit::Value ; "Apple¶Grape" ) )

              • 4. Re: Hide object when field contains either of two words
                erolst

                Displaying a graphic that indicates a sub-menu should not be a function of a menu item's name, but of its state: does it have sub-menu items?

                1 of 1 people found this helpful
                • 5. Re: Hide object when field contains either of two words
                  Jesse_Wright

                  Thanks Eric,

                   

                  Not quite (as I understand it). I don't need both conditions to occur (Apple "and" Grape) in the field. Rather it's more like I'm looking for "either" Apple or Grape make the condition True.  I want to hide the object in the record if the FruitType::Value  ≠ "Apple" or "Grape".

                   

                  Best,

                  Jesse

                   

                  • 6. Re: Hide object when field contains either of two words
                    flybynight

                    The behavior makes sense. Given your calculation:

                    FruitType::Value  ≠ "Apple" or FruitType::Value  ≠ "Grape"

                    One of those epressions is always going to be true. Apple ≠ Grape, and Grape ≠ Apple, along with any other fruit ≠ to either of those.

                    You could test with "and" instead or FilterValues, as people have suggested…

                     

                    But I have to agree with erolst. You are setting yourself up for a lot of maintenance here. If you add any other fruit that will have color options, you will have to go back in and alter your calculations each time. Better to have it actually base the hide calc on the actual condition that you are testing for: are there sub-options. That way, if you add options or change your business logic (say you are only going to stock green apples from now on), your interface will just adapt automatically, rather than you having to go in and re-tool things. A little trickier, but worth it in the long run. I would try something like:

                    IsValid SubMenuTO::__kp_colorID

                    I'm not in 13 right now to test, but I've used something similar before. Basically using the relationship from Fruit to FruitColors to check if there are values along that path. Check for something in a field that will never be blank - the primary key field.

                     

                    HTH,

                    -Shawn

                    • 7. Re: Hide object when field contains either of two words
                      flybynight

                      Jesse_Wright wrote:

                      Not quite (as I understand it). I don't need both conditions to occur (Apple "and" Grape) in the field. Rather it's more like I'm looking for "either" Apple or Grape make the condition True.  I want to hide the object in the record if the FruitType::Value  ≠ "Apple" or "Grape".

                      Actually, you DO need both of those conditions to occur. Since you are telling it when to hide, rather than when to show. You aren't looking for either Apple or Grape to make the condition true, you are looking for neither Apple, nor Grape.

                      Sometimes tough to wrap your head around how the calc is evaluating. If you use "and" then you are testing for both values to not be there, and either value will cause the calc to be false, and not hide (show) the object.

                       

                      But, do consider the other post for future-proofing your solution.

                      -Shawn

                      • 8. Re: Hide object when field contains either of two words
                        Jesse_Wright

                        Not a menu persay, but a "field picker" layout in list view that is script triggered to either write back the selection, or move forward to additional field picker layouts to continue to define the selections. So it doesn't have any buttons to which I could just add the graphic. Rather it is a table list of "values".

                         

                        To put it into contex, I am redeveloping an archaeological site field form for FM Go 13. It is as thumb driven as I can get it, so very little use of the keypad to type in anything except the Site name and a Field Site number. Everything else is either using a native "dropdown" value list on simple fields like State, County, or Yes/No questions.  But for Form items that require description, like Site Type, the first Field Picker layout has about 30 records describing each of the "Types" defined: Prehistoric Scatter; Open Habitation, Earthlodge, Rockshelter/cave, Isolated burial, Burial Mounds, ect..  Then, if the answer requires some more specifics, I move the user to a second Field Picker layout for that item.  Say "Burial Mounds" was selected, then the following Field Picker layout of values would list: Effigy, Conical, Linear, Unspecified type.  If I tap Effigy and that selection requires further specification, I would move them to a third layout of selections.  The combined selections are retured to the main data collection form layout.  So for what I described here for Site Type, it would set Mounds, Effigy.  Two taps and it is entered and they move on to the next field.

                         

                        So this graphic has no real function and is not critical, the user is going to get as many lists as required to answer the question, but I thought the graphic would be a nice visual for the user to expect a muli-step answer. Just was playing around with some of the new features in FM 13, and just absolutley fixated on this one cause I just couldn't get it to work. So I want to understand why or what I'm not understanding.  Baptism by fire! 

                         

                        ...and I'd like to see it in the solution too of course!

                         

                        Best,

                        Jesse

                        • 9. Re: Hide object when field contains either of two words
                          Jesse_Wright

                          Ah I understand now!

                           

                          I had tried it with "and" and the result was a list with no graphics. So I didn't look at it again since I had it in my head that OR was my operatoer since I thought I was looking for one or the other, or both; plus you are right I didn't have my head wrapped around it. 

                           

                          I tried that again in my demo and it worked. I dug around my original solution knowing full well I had tried "and" and discovered that my error was a space after "Grape "

                           

                          All that headache over a space.  Good lesson!  That and a clearer understanding of it all now thanks to you and Erik.

                           

                           

                          As for future proofing, I appreciate the nudge in the right direction!

                           

                          Thanks to all!

                           

                          Best,

                          Jesse

                          • 10. Re: Hide object when field contains either of two words
                            keywords

                            Based on this expanded description I suggest a different approach.

                             

                            1.     As you describe it, the colour tables in your sample file are really just lists of values—so use them that way as the basis of value lists.

                            2.     The fruit table is the real data table you are using, and colour is an attrbute of some fruit—so add a field for this attribute

                            3.     Because you are building a GO app, you want to minimise typing—so use radio button list entry

                            4.     The list displayed depends on which fruit is entered—so create separate field instances and display accordingly

                             

                            Attached is a modified sample file which applies the above. You will find there are two instances of the colour field each with its own list and visibility condition. If the same hide condition applies to a number of fields or objects, you can use slide controls to control the visibility of the whole lot at once by applying the visibility to the panel. I have included a second layout to show this—here there are two sliders stcked on top of each other, but you can drag them apart to see what's going on.

                             

                            Hope that is of some help in your quest for a better field app!