Hi @Mahesh Kumar Arumuga Perumal
You're looking to filter a list of tables (from a Lookup activity) using a parameterized list (table_filter
), with a fallback that loads all tables if the parameter is left null. That’s a great use case and can definitely be done in ADF the only issue was with how contains()
was being used.
cause
In your expression, you used contains()
to check if a table name exists in a list generated by split()
. While this seems logical, contains()
in ADF is designed to work with strings not arrays so it doesn't behave as expected when used with split(...)
.
To check if an item exists in an array, you should use the indexOf()
function instead. Here's the corrected expression you can use in your Filter activity:
@if(
equals(pipeline().parameters.table_filter, null),
true,
not(equals(indexOf(split(toLower(pipeline().parameters.table_filter), ','), toLower(item().tabname)), -1))
)
How the Expression Works:
The expression first checks whether the table_filter
parameter is null. If it is, the condition returns true
, allowing all tables from the Lookup activity to pass through without filtering. If table_filter
contains specific values like "orders,customers"
, it splits that string into an array, converts both the array elements and the current item().tabname
to lowercase for case-insensitive comparison, and then uses the indexOf()
function to determine if the current table name exists in the array. Only tables that are included in the list will pass through the filter.
If you set:
"table_filter": "orders,products"
Then only orders
and products
will be processed.
If table_filter
is left empty or null, all tables from the Lookup will pass through.
References:
Kindly consider upvoting this response if you found it helpful it may help other community members facing similar issues.