dataflow filter expression

arkiboys 9,686 Reputation points
2024-05-22T05:53:55.4533333+00:00

hello,

can you help me with this filter expression when I am loading data?

my goal is:

if strategy is one of these two, i.e. stra1, stra2 then make sure the party is one of these, i.e.

party=p1 or party=p2 or party = p3

if strategy is not stra1 or stra2 then load everything irrespective to party


my solution is this but it does not seem to be working as expected:

!(lower(trim(strategy)) == 'stra1' || lower(trim(strategy)) == 'stra2')

||

(

(lower(trim(strategy)) == 'stra1' || lower(trim(strategy)) == 'stra2')

&&

(

lower(trim(party)) == 'party1'

|| lower(trim(party)) == 'party2'

|| lower(trim(party)) == 'party3'

|| lower(trim(party)) == 'party4'

)

)

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,893 questions
0 comments No comments
{count} votes

Accepted answer
  1. hossein jalilian 4,540 Reputation points
    2024-05-22T06:29:50.7333333+00:00

    Thanks for posting your question in the Microsoft Q&A forum.

    This expression should work correctly in Azure Data Factory to filter your data according to the specified logic

    (
        lower(trim(strategy)) != 'stra1' 
        && lower(trim(strategy)) != 'stra2'
    )
    ||
    (
        (lower(trim(strategy)) == 'stra1' || lower(trim(strategy)) == 'stra2')
        &&
        (
            lower(trim(party)) == 'party1'
            || lower(trim(party)) == 'party2'
            || lower(trim(party)) == 'party3'
            || lower(trim(party)) == 'party4'
        )
    )
    
    

    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful