Error with filter using And and Or functions

%3CLINGO-SUB%20id%3D%22lingo-sub-1126286%22%20slang%3D%22en-US%22%3EError%20with%20filter%20using%20And%20and%20Or%20functions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1126286%22%20slang%3D%22en-US%22%3E%3CP%3EGetting%20an%20Invalid%20number%20of%20arguments%20when%20running%20the%20following%20script.%20I%20need%20to%20only%20show%20lines%20from%20the%20list%20where%20the%20user's%20email%20matches%20one%20of%20three%20fields%20and%20another%20corresponding%20field%20is%20blank.%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3ESortByColumns(%0A%20%20%20%20Filter(Transfers%2C%0A%20%20%20%20%20%20%20%20Or(And(IsBlank('Receiving%20Custodian%20Approval')%2C%20varUserEmail%3D'Receiving%20Asset%20Custodian%20Email')%2C%20And(IsBlank('Receiving%20Manager%20Approval')%2C%20varUserEmail%20%3D%20'Receiving%20Manager')%2C%20And(IsBlank('Current%20Manager%20Approval')%2CvarUserEmail%20%3D'Current%20Manager')%20%0A%20%20%20%20)%2C%0A%22Title%22%2CDescending))%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EStill%20fairly%20new%20to%20PowerApps%20been%20reading%20lost%20of%20forum%20post%20to%20get%20this%20far.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1126286%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EPowerApps%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1165273%22%20slang%3D%22en-US%22%3ERe%3A%20Error%20with%20filter%20using%20And%20and%20Or%20functions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1165273%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F530633%22%20target%3D%22_blank%22%3E%40Chris77089%3C%2FA%3E%26nbsp%3BHeya%2C%20it%20reads%20each%20%22%2C%22%20as%20a%20new%20argument%2C%20so%20you%20need%20to%20use%20%26amp%3B%26amp%3B%20or%20%7C%7C%20for%20and%20%26amp%3B%20or%20statements%20respectively.%20I%20think%20this%20should%20work%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESortByColumns(Filter(Transfers%2C%3CBR%20%2F%3E(IsBlank('Receiving%20Custodian%20Approval')%26amp%3B%26amp%3B(varUserEmail%3D'Receiving%20Asset%20Custodian%20Email'))%7C%7C(IsBlank('Receiving%20Manager%20Approval')%26amp%3B%26amp%3BvarUserEmail%20%3D%20'Receiving%20Manager')%7C%7C(IsBlank('Current%20Manager%20Approval')%26amp%3B%26amp%3BvarUserEmail%20%3D'Current%20Manager'))%2C%3CBR%20%2F%3E%22Title%22%2CDescending))%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

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

@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))