1

I'm having another issue with my Filter formula. I have a gallery and I added a control (an icon) called FilterToggle which has a simple toggle action -- the OnSelect says

UpdateContext({FilterToggle:!FilterToggle})

This appears to work correctly as I have the color of the icon toggle on and off, based on an IF statement in the Color formula.

On my Gallery, my Items formula is set to:

If('FilterToggle'=false,
    {SortByColumns(
        Search(
            'Inbound RM Inspection',
            SearchBox.Text,
            "Title"
        ),
        "Title"
        )
    },
    {SortByColumns(
        Search(
            Filter('Inbound RM Inspection','INSP-NOW'=YES),
            SearchBox.Text,
            "Title"
        ),
        "Title"
        )
    }
)

The purpose is to include all Items if the FilterToggle is False and to include only those items who have INSP-NOW set to YES if FilterToggle is True.

Now all I get is an Invalid Argument Type.

Prior to adding this filter component, my Items formula was a just:

SortByColumns(
    Search(
        'Inbound RM Inspection',
        SearchBox.Text,
        "Title"
    ),
    "Title"
)

and it worked fine, so it's either the way I have the IF statement formatted, or the Filter command.

Thanks, gpence

1

The variable shouldn't be in quotes, and the curly braces aren't needed. try:

If(FilterToggle=false,
SortByColumns(
    Search(
        'Inbound RM Inspection',
        SearchBox.Text,
        "Title"
    ),
    "Title"
    )
,
SortByColumns(
    Search(
        Filter('Inbound RM Inspection','INSP-NOW'.Value="YES"),
        SearchBox.Text,
        "Title"
    ),
    "Title"
    )
)

Edit: added .Value, as this is a choice field.

  • Well, Mike... that took away the red error flags, but now I get no data displayed -- either with the filter variable FilterToggle true or false! When I check the AppChecker it says the ItemNumberGallery.Items has an Invalid argument type... @Mike2500 – gpence Dec 18 '18 at 19:47
  • The invalid argument type is probably the =YES, which should be in double-quotes: ="YES" – Mike2500 Dec 18 '18 at 19:56
  • That didn't work either... and I notice an oddity which I can't explain. When I edit the Items formula, I expand the edit box down, but I noticed the Format Text and Remove Formatting options at the bottom are grayed out. If I copy and paste the previous formula (without the IF statement) then they are enabled. As someone's who worked with JS and CFML most recently, these formulas are... finicky. – gpence Dec 18 '18 at 20:19
  • The disabled format text button is caused by invalid syntax. For example, if I remove the last parenthesis, the same thing happens to me. One more item, if INSP-NOW is a sharepoint yes/no field, then it should actually be =true, not yes, though that shouldn't cause the other issues. – Mike2500 Dec 18 '18 at 20:28
  • Yeah, it's a Choice field and I tried YES/NO, True/False and 0/1 and still no success yet. – gpence Dec 18 '18 at 20:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.