cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Strange behaviour with the Filter Array step

Hey

 

I have a relatively simple flow which gets data from Salesforce, then filters it, converts it to a csv and saves that csv in sharepoint. For the most part it is working howeer the filter array step is exhibiting some od behaviour.

 

So I am loading in the data from the get records salesforce step, which is working correctly from what I can tell.

Then I am filtering the array with the following logic.

 

 

@or(
    and(
        equals(item()?['Action_Date__c'],null),
        not(equals(item()?['Forecast_CRFS_Date__c'],null)),
        greaterOrEquals(item()?['Forecast_CRFS_Date__c'],startOfMonth(utcNow())),
        less(item()?['Forecast_CRFS_Date__c'],addToTime(startOfMonth(utcNow()),1,'Month'))
    ),
    and(
        not(equals(item()?['Action_Date__c'],null)),
        greaterOrEquals(item()?['Action_Date__c'],startOfMonth(utcNow())),
        less(item()?['Action_Date__c'],addToTime(startOfMonth(utcNow()),1,'Month'))
    )

Essentially what it does is if a field called Action date has a non null value it filters by that column. If that column is null then it filters by a different column.

 

The second step works fine it is with the first step it breaks down. Within the first step, the first filter works fine, it ensures the forcast CRFS date column is greater or equal to the start of the month. However the second step which ensures that it is less than the start of the next month doesn't it will let some rows which are in the next month through into the CSV.

 

Does anyone have any idea why this is happening? Have I made a mistake in my WDL?

Any help is greatly appreciated. 

 

1 REPLY 1
v-zhos-msft
Solution Sage
Solution Sage

Hi @Anonymous ,

According to your description, you want to get the records during this month.

I have did some tests on my side, when you use the addToTime() function to add 1 month to a timestamp , it will add 31 days as default.

I suggest you to change the expression to ‘startOfMonth(getFutureTime(1,'Month'))’ or 'startOfMonth(addToTime(utcNow(),1,'Month'))'.

 

Best Regards,

Community Support Team _ Zhongys

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors
Users online (1,618)