cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Megaoctane
Helper I
Helper I

Check if folder name is a valid date, else return blank/null

I need a flow to add metadata to files created in a document library. if the parent folder is a valid date format dd.mm.yyyy, then i want to pick this as date, if not, the return blank/null.

I have tried with Compose and split, and then get the date with expression:

 

formatDateTime(concat(outputs('Komponer')[2],'-',outputs('Komponer')[1],'-',outputs('Komponer')[0]),'yyyy-MM-dd')'

But if the foldername is not a date, the flow fails to run.

 

Failed flow:

Flow.png

 

 

When it works:

Flow 2.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-yujincui-msft
Community Support
Community Support

Hi @Megaoctane ,

 

Do you want to check if folder name is a valid date?

I suggest you just use numbers as folder names, if you use words for month, it doesn't seem to be able to format as a time in the end.

vyujincuimsft_0-1643191711570.png

After you get the name of the parent folder, use a space as a delimiter to split it into an array, and then determine whether the length of the array is equal to 3.

 

I have made a test for your reference.

vyujincuimsft_3-1643192811333.png

vyujincuimsft_1-1643192680046.png

vyujincuimsft_2-1643192757772.png

Result Screenshot:

vyujincuimsft_4-1643192898852.png

 

Best Regards,

Charlie Choi

View solution in original post

1 REPLY 1
v-yujincui-msft
Community Support
Community Support

Hi @Megaoctane ,

 

Do you want to check if folder name is a valid date?

I suggest you just use numbers as folder names, if you use words for month, it doesn't seem to be able to format as a time in the end.

vyujincuimsft_0-1643191711570.png

After you get the name of the parent folder, use a space as a delimiter to split it into an array, and then determine whether the length of the array is equal to 3.

 

I have made a test for your reference.

vyujincuimsft_3-1643192811333.png

vyujincuimsft_1-1643192680046.png

vyujincuimsft_2-1643192757772.png

Result Screenshot:

vyujincuimsft_4-1643192898852.png

 

Best Regards,

Charlie Choi

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (3,952)