question

ewinkiser avatar image
0 Votes"
ewinkiser asked MartinJaffer-MSFT commented

@Contains expression issue...please help....

Hello! @nasreen-akter @MartinJaffer-MSFT

As usual, I am having trouble with an Expression in a Filter activity...

I want to say if all employees with @item.Company = BCO, BED, BSC, and BNB proceed...all others filter out but I can't get the syntax correct....have worked on this for a while...

This is what I tried:

@or(contains(item().company,'BCO'),contains(item().company,'BED'), contains(item().company,'BSC'), contains(item().company,'BNB'))

But doesn't work....

Thanks!
Mike

azure-data-factory
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@ewinkiser if nasreen's answer solved your issue, please mark as accepted answer.

0 Votes 0 ·

1 Answer

nasreen-akter avatar image
0 Votes"
nasreen-akter answered ewinkiser edited

Hi @ewinkiser,

The following expression might help. Thanks!

 @contains(createArray('BCO','BED','BSC','BNB'), item.Company)
· 6
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@nasreen-akter

Thanks so much! however I am getting the following error and I have company coming back in a LookUp function.....any suggestions?

@contains(createArray('BCO','BED','BSC','BNB'), item.company)


I used the following in the Filter activity and it should be working....any ideas? Thanks!!! Mike
87472-image.png

87357-image.png


87426-image.png


0 Votes 0 ·
image.png (87.7 KiB)
image.png (53.4 KiB)
image.png (84.2 KiB)

@nasreen-akter @ewinkiser

item is a pseudo-function, like activity. unlike activity it does not take any arguments.

you want to use

 item().company
2 Votes 2 ·

Thanks all! @MartinJaffer-MSFT @nasreen-akter

Works perfectly!!! Thanks so much. We are getting ready to go live with a new ADF centric application and I am having to fix QA bugs. I just got another change (these are killing me lol)...

@contains(createArray('BCO','BED','BSC','BNB'),item().company)

I need to say now the above AND if Classcode = 'EMP" for the filter....

Just guessing, would I say:
@contains(createArray('BCO','BED','BSC','BNB'),item().company) && item().classcode = "EMP" or something like that?

Thanks again!
Mike

0 Votes 0 ·
Show more comments

@ewinkiser, In the expression, please use Company from Lookup activity instead of item.Company.

1 Vote 1 ·