Forum Discussion

Chris77089's avatar
Chris77089
Copper Contributor
Jan 23, 2020

Error with filter using And and Or functions

Getting an Invalid number of arguments when running the following script. I need to only show lines from the list where the user's email matches one of three fields and another corresponding field is blank.

SortByColumns(
    Filter(Transfers,
        Or(And(IsBlank('Receiving Custodian Approval'), varUserEmail='Receiving Asset Custodian Email'), And(IsBlank('Receiving Manager Approval'), varUserEmail = 'Receiving Manager'), And(IsBlank('Current Manager Approval'),varUserEmail ='Current Manager') 
    ),
"Title",Descending))

Still fairly new to PowerApps been reading lost of forum post to get this far. 

1 Reply

  • IzLove's avatar
    IzLove
    Copper Contributor

    Chris77089 Heya, it reads each "," as a new argument, so you need to use && or || for and & or statements respectively. I think this should work:

     

    SortByColumns(Filter(Transfers,
    (IsBlank('Receiving Custodian Approval')&&(varUserEmail='Receiving Asset Custodian Email'))||(IsBlank('Receiving Manager Approval')&&varUserEmail = 'Receiving Manager')||(IsBlank('Current Manager Approval')&&varUserEmail ='Current Manager')),
    "Title",Descending))

Resources