cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Cukr
Frequent Visitor

Problem with variable

Hello, 

I have a problem with initializing variable.  In flow I'm trying to achieve automate deletion of files which are older than 7 days. But variable is the last thing that is doing problems. I've looked at lot of forums but it is not working. 

There is the variable:

 

 

greater(utcNow('yyyyMMdd'), formatDateTime(adddays(item()?['Created'],7),'yyyyMMdd'))

 

 

  There is scheme of Flow: 

 
 

1.png2.png
Many thanks for any support!


2 REPLIES 2
edgonzales
Super User II
Super User II

@Cukr 

Hi there.  It looks like the expression in your variable is referencing something that hasn't happened yet (with the item() part).

 

Try initializing the variable like you have it, but leave the value blank.

Then after your Get file properties bit, add a "Set variable" action with that same expression.  It may want to be inside of your Apply to each loop, not sure.

 

Also, check out using a Compose rather than the variable.  It might work better for you, as well.

Keep us posted.

-Ed

 

If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

Cukr
Frequent Visitor

Hi, 

I've tried to do that as you said and it doesn't work. I guess  there is problem in me, because I do not understand Flow very well 😄
Value in item() is blank. 

 

Here I just deleted "7"

greater(utcNow('yyyyMMdd'), formatDateTime(adddays(item()?['Created'],'yyyyMMdd'))


 

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Users online (44,297)