Filter Pivot Table Activity

Hello,
Could someone tell me what do I need to do if a filter is not present in the current pivot table? When I configure the filter one by one, it filters correctly. but if the filter is not there, it throws an error: “Filter value(s) not found on the field” and does not filter the ones that are found. is there a way to use the filter pivot activity with CONTAINS or is there another way to filter the pivot for the ones that are on the pivot table?

Thank you

@meghan.myers

Did you try this?

Cheers

@meghan.myers ,

We don’t have option to filter Pivot with CONTAINS in UiPath. But you got below two options:

  1. Use this front end like this sample.
    FilterPivotTableExcel.zip (35.3 KB)

  2. Use VBA code to achieve the result.

Thanks,
Ashok :slight_smile:

that is what I am currently using.

I would like to update this ask: I want to save the filter values in an excel file. Read the values, store as a variable and filter the pivot with the variables. I also, need a condition if the filter value is not present in the pivot - because sometimes it will be present, sometimes it will not.
I searched the forum and could not find anything for this. Any suggestions? thank you

Hey @meghan.myers

Use below mentioned LinQ in If Activity, then Pivot Activity in Then part and In Else as per your requirement

dt_Input.AsEnumerable.Any(Function(x) x("YourColumnName").ToString.Trim.ToLower.Contains("yourvalueinlowercase"))

Or

If you want to filter Multiple Values in same column then:

dt_Input.AsEnumerable.Any(Function(x) x("YourColumnName").ToString.Trim.ToLower.Contains("yourvalueinlowercase") OrElse x("YourColumnName").ToString.Trim.ToLower.Contains("your2ndvalueinlowercase"))

Above LinQ will definitely resolve your issue, I had also faced similar issue earlier!

Regards,
Ajay Mishra

Thank you for your response.
Just to make sure I understand. Your condition looks at a certain column in datatable for a certain value and if true, it filters pivot table?

@meghan.myers the column name you want to filter and the value that should be in that column.

In the screenshot, it is according to my project!

You have to change accordingly.

Regards,
Ajay Mishra