cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Append Text to File Name in Save As box

Hi,

 

Wondering if there's a way to append text to file name when saving a file in Save As box. Whenever I append text to the original file name using Desktop Automate, it just takes that whole file name and inserts it the same way to any future files being downloaded. Any way to just add a string to the original file name?

1 ACCEPTED SOLUTION

Accepted Solutions

Here is the more official version of the logic I pasted below.  You can copy the text below the screenshot and should be able to paste it right into a subflow.

 

MichaelAnnis_3-1637336210228.png

 

DateTime.Local DateTimeFormat: DateTime.DateTimeFormat.DateOnly CurrentDateTime=> CurrentDateTime4
SET KnownFriday TO $'''11/05/2021'''
DateTime.Subtract FromDate: CurrentDateTime4 SubstractDate: KnownFriday TimeUnit: DateTime.DifferenceTimeUnit.Days TimeDifference=> DateDifference
SET Weeks TO DateDifference / 7
Variables.GetIntegerPart Number: Weeks Result=> WeeksTruncated
DateTime.Add DateTime: KnownFriday TimeToAdd: WeeksTruncated * 7 TimeUnit: DateTime.TimeUnit.Days ResultedDate=> ResultedDate
Text.FromCustomDateTime DateTime: ResultedDate CustomFormat: $'''MMddyyyy''' Result=> FormattedDateTime4
Display.ShowMessage Title: $'''Result''' Message: FormattedDateTime4 Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed6

 

 

----
If my post has answered your question, please thumbs up and mark this post as a solution.

I also offer paid consulting services at www.peakdigitran.com/appointments and you can find me on LinkedIn at https://www.linkedin.com/in/michael-annis-80903/,

View solution in original post

14 REPLIES 14

If you're working in what's primarily a web workflow, you should try adding the UI element.  Most 'Save As' boxes are listed as a Combo box.

Once you've got the UI element, you can use the Populate text field in window option. See below:

Slavnyy_Avtomat_0-1637262365722.png


To answer your question specifically, you could store the base version of your file name as a variable, let's say %YourFile%, then populate the save as field with that variable + whatever you'd like to append:

%YourFile%whatever.other.things.you.want.to.append  -- does that make sense?

So would this allow for a dynamic file name each time it's downloaded? From what I understand this: %YourFile%whatever.other.things.you.want.to.append would keep it the same file name every time, which I want to avoid. Maybe I'm missing it.

Also, any way to populate a dynamic date into the file name? Let's say, next coming Friday from each download date. So if file was downloaded any day this week, 11.19.21 would be placed into the file name.

Yes, you can enter variables anywhere you want in the text, so:

%YourFile%_%Whatyouwanttoappend% would also work.  Where %YourFile% is "Final" and %Whatyouwanttoappend% is "Product", written that way would be "Final_Product"

----
If my post has answered your question, please thumbs up and mark this post as a solution.

I also offer paid consulting services at www.peakdigitran.com/appointments and you can find me on LinkedIn at https://www.linkedin.com/in/michael-annis-80903/,

Thank you, Michael. That works pretty well. Would you be able to help me with an expression to fill in date of last Friday? So for example, if I ran the flow today, it would enter 11.12.21 into file name.

@Peter13 

To keep you moving can you give some clarity on what is written in the post.

You mentioned if the flow is run today it should show date of Last Friday. But 11.12.21 is not Friday. So a bit confused here.

11/12/21 MM/dd/yy is a Friday; sorry for the confusion there @VJR .  Here is the logic, I am not at my computer to show you:

 

Get CurrentDateTime

Set variable %KnownFriday% to 11/5/21 (may have to convert this to date if it doesn’t default to a date variable type. 

Subtract Dates %CurrentDateTime% - %KnownFriday% to %DateDifference%
Set %weeks% to %DateDifference / 7% (this will give us the number of weeks with decimal ex for 11/18/21 would be 1.87…)

Truncate number %weeks% (this will remove decimals Ex. 1) to %WeeksTruncated%

Add To Date %KnownFriday% Days %WeeksTruncated * 7% (this will add, in our example, 7 days to the known Friday, or 11/12/21)

Lastly, you’ll want to ‘Convert Date to text’ in whatever custom format you want. Be sure to use capital Ms for the month (ex. MMddyyyy).

 

Whatever that converted variable is in ‘Convert Date to text’ is the one you can put in your file name. 

 

----
If my post has answered your question, please thumbs up and mark this post as a solution.

I also offer paid consulting services at www.peakdigitran.com/appointments and you can find me on LinkedIn at https://www.linkedin.com/in/michael-annis-80903/,
VJR
Multi Super User
Multi Super User

This is causing the confusion to me at least 🙂

 

Below lines taken from above posts...

 

- So if file was downloaded any day this week, 11.19.21 would be placed into the file name.

- So for example, if I ran the flow today, it would enter 11.12.21 into file name.

Hi VJR,

 

Let me clarify. I'm using Power Automate to pull a file from a web page every week. The file name is random and does not provide any information to better identify it. Michael helped me with inserting a Company ID in the file name when saving and I also want to add a Statement Date to it. The Statement Date is always a Friday while the statement comes out Tuesday night following a Friday. Taking this week as an example, last week a Friday was 11.12.21 and I would run the flow anytime between Tuesday night of 11.16 to Thursday 11.18. So when a file is downloaded between the dates just mentioned, the expression would return the same settlement date into the file name of 11.12.21. Hope this clarifies.

Here is the more official version of the logic I pasted below.  You can copy the text below the screenshot and should be able to paste it right into a subflow.

 

MichaelAnnis_3-1637336210228.png

 

DateTime.Local DateTimeFormat: DateTime.DateTimeFormat.DateOnly CurrentDateTime=> CurrentDateTime4
SET KnownFriday TO $'''11/05/2021'''
DateTime.Subtract FromDate: CurrentDateTime4 SubstractDate: KnownFriday TimeUnit: DateTime.DifferenceTimeUnit.Days TimeDifference=> DateDifference
SET Weeks TO DateDifference / 7
Variables.GetIntegerPart Number: Weeks Result=> WeeksTruncated
DateTime.Add DateTime: KnownFriday TimeToAdd: WeeksTruncated * 7 TimeUnit: DateTime.TimeUnit.Days ResultedDate=> ResultedDate
Text.FromCustomDateTime DateTime: ResultedDate CustomFormat: $'''MMddyyyy''' Result=> FormattedDateTime4
Display.ShowMessage Title: $'''Result''' Message: FormattedDateTime4 Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed6

 

 

----
If my post has answered your question, please thumbs up and mark this post as a solution.

I also offer paid consulting services at www.peakdigitran.com/appointments and you can find me on LinkedIn at https://www.linkedin.com/in/michael-annis-80903/,

Hi Michael,

 

Thank you for providing the steps. There's a lot going on there and I just want to make sure I understand all the components.

 

1) DateTime.Local DateTimeFormat: DateTime.DateTimeFormat.DateOnly CurrentDateTime=> CurrentDateTime4 (is CurrentDateTime4 a variable that needs to be created? And is the value everything up to and including "=>"?)

 

2) SET KnownFriday TO $'''11/05/2021''' (so the value would be "$"'11/05/2021'"?)
3) DateTime.Subtract FromDate: CurrentDateTime4 SubstractDate: KnownFriday TimeUnit: DateTime.DifferenceTimeUnit.Days TimeDifference=> DateDifference (this is variable DateDifference with value of everything and including =>?)
SET Weeks TO DateDifference / 7
Variables.GetIntegerPart Number: Weeks Result=> WeeksTruncated
DateTime.Add DateTime: KnownFriday TimeToAdd: WeeksTruncated * 7 TimeUnit: DateTime.TimeUnit.Days ResultedDate=> ResultedDate
Text.FromCustomDateTime DateTime: ResultedDate CustomFormat: $'''MMddyyyy''' Result=> FormattedDateTime4
Display.ShowMessage Title: $'''Result''' Message: FormattedDateTime4 Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed6

1)  CurrentDateTime4 is simply just today's date.  The key is the part that says (.DateOnly); otherwise it would pull in the time to.  This action won't.

2)  Yes %KnownFriday% is just 11/05/2021 and will always be that, you never have to change it.  Any known Friday before the day you run this will do.

3)  %DateDifference% is the number of days between Today - known Friday.  So, if you were to run this today (11/19/21), then this would be 14 (11/19/21 - 11/5/21). 

----
If my post has answered your question, please thumbs up and mark this post as a solution.

I also offer paid consulting services at www.peakdigitran.com/appointments and you can find me on LinkedIn at https://www.linkedin.com/in/michael-annis-80903/,

So I've attempted to replicate all the steps. I set up the variables and ran the flow. I'm getting this error at Subtract Dates: Argument "SubtractDate" must be"Datetime".

 

Could you please take a look at the variables below and see where I might have gone wrong?

CurrentDateTime4.JPGDateDifference.JPGKnownFriday.JPGSubtract Dates.JPG

First, CurrentDate and KnownFriday have to be Date Type variables.

 

Secondly, You don't have to use "Input Variable".  Input Variables are used when you manually want to change it every time you run the bot.

 

Get CurrentDateTime is an action that you can run.  See my screenshot in the previous post.

Set Variable %KnownFriday% to 11/05/2021 declares the variable and chooses a default variable type.  It should default to date.  Literally, all you should have to do is copy the text below the screenshot and paste in a subflow.  Then you should see a flow exactly like my screenshot.

 

If you insist on making these input variable, then you will have to set them to 'Date' variable types.

 

 

----
If my post has answered your question, please thumbs up and mark this post as a solution.

I also offer paid consulting services at www.peakdigitran.com/appointments and you can find me on LinkedIn at https://www.linkedin.com/in/michael-annis-80903/,

Hi Michael,

 

Thank you for your help on this. I haven't worked with Subflows before so had to get acquainted with it. Also, when I created a new Subflow there was no place to paste the text you've provided. After spending sometime researching with no solution, I just hit Ctrl + V and it pasted. There were errors that came back, but I went one by one and resolved them based on your code.

 

It works now! The last Friday date is being populated into the file name. Thank you again. Really appreciate your help.

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Summer of Solutions | Week 3 Results | Win free tickets to the Power Platform Conference

We are excited to announce the Summer of Solutions Challenge!    This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24  17 @Anil_g  7 @ManishSolanki  13 @eetuRobo  5 @David_MA  10 @VishnuReddy1997  5 @SpongYe  9JhonatanOB19932 (tie) @Nived_Nambiar  8 @maltie  2 (tie)   @PA-Noob  2 (tie)   @LukeMcG  2 (tie)   @tgut03  2 (tie)       Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate  @Deenuji  12@ManishSolanki 19 @Anil_g  10 @NathanAlvares24  17 @VishnuReddy1997  6 @Expiscornovus  10 @Tjan  5 @Nived_Nambiar  10 @eetuRobo  3 @SudeepGhatakNZ 8     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22  

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (3,892)