0

I have problem put all code together for filtering my Gallery.

I have 3x DropDown input's, one text input and double date picker's. When i no use any filter, i want to show all items in Gallery. My idea was, create code for each type of filter and put them together. But my code show all item in gallery but no filtering.

For null value in DropDown ussing vardd1Blank, vardd2Blank, vardd3Blank, next Sort and IF statement

With(
{
    vardd1Blank: IsBlank(dd1Search.Selected.Value),
    vardd2Blank: IsBlank(dd2Search.Selected.Value),
    vardd3Blank: IsBlank(dd3Search.Selected.Value)
},
Sort(
    If(
        vardd1Blank,
        galleryItems,
        vardd2Blank,
        galleryItems,
        vardd3Blank,
        galleryItems,
        Filter(
            galleryItems,
                StartsWith(
                Note,
                txtSearchNote.Text ) || (IsBlank(txtSearchNote.Text)),
                IsBlankOrError(txtNote.Text) || txtSearchNote.Text in Note.Value,
                'dd1'.Value = dd1Search.Selected.Value || 
                'dd2'.Value = dd2Search.Selected.Value || 
                'dd3'.Value = dd3Search.Selected.Value,
                ('Date' > dp1) && ('Date' < dp2)
         )
       ),
       'ID',
       Descanding
       )
       )

Thank you for any advice

1 Answer 1

1

Try using this formula for items property of gallery control:

Sort(
    Filter(
        galleryItems,
        IsBlankOrError(txtSearchNote.Text) || StartsWith(Note,txtSearchNote.Text),
        IsBlankOrError(txtNote.Text) || txtNote.Text in Note.Value,
        IsBlankOrError(dd1Search.Selected.Value) || 'dd1'.Value = dd1Search.Selected.Value,
        IsBlankOrError(dd2Search.Selected.Value) || 'dd2'.Value = dd2Search.Selected.Value,
        IsBlankOrError(dd3Search.Selected.Value) || 'dd3'.Value = dd3Search.Selected.Value,
        'Date' > dp1 && 'Date' < dp2
    ),
    'ID',
    Descanding
)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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