web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Using Initialize Varia...
Power Automate
Answered

Using Initialize Variable versus Compose to get the output of a function

(0) ShareShare
ReportReport
Posted on by 14

The scenario is a flow triggered by a form submission. The flow adds the form responses to an Excel file in SharePoint and then invokes a script in the file to do some additional processing.

 

Because the anonymous respondents can be located anywhere in the world, I needed to convert the form submission date and time stamp to Eastern Standard Time. Looking online I found the required timezone conversion function, but the example used a Compose action to invoke the function and then used the output from that to set a variable.

 

I don't like adding extra steps in my flows, so instead I used the Initialize Variable action to define a variable to hold the result and in the initial value field for the action I created an expression with the timezone conversion function. In the "Add a Row to an Excel file" action, I used the resulting variable for the corresponding field in the SharePoint Excel file.

 

This works, but I'm wondering if there is some hidden gotcha to this approach?

Categories:
I have the same question (0)
  • Verified answer
    DJ_Jamba Profile Picture
    2,837 Super User 2025 Season 2 on at

    Hi @MisterDon 

     

    No gotchas. You can use a variable but the example you looked at was correct to use a Compose.

    Constants (values that don't change throughout your flow) - Use Compose

    Variables (values that change throughout your flow) - Use Variables

     

    The flow will assign a variable lock on variables and if you have a lot in your flow, it can slow the flow down. 

  • MisterDon Profile Picture
    14 on at

    @DJ_JambaThanks for the quick and informative response. Makes sense.

     

    So in this case if I use Compose to convert the date/time, then rather than creating a variable, which as you point out isn't really varying, I would find the Compose output under dynamic content when entering the value for the corresponding Excel file column, right?

  • DJ_Jamba Profile Picture
    2,837 Super User 2025 Season 2 on at

    Spot on or you could use the Convert time zone action

    DJ_Jamba_0-1713218196544.png

    and select that action from dynamic content instead...

  • MisterDon Profile Picture
    14 on at

    @DJ_Jamba- Nice! I'm marking your first reply as the accepted solution.

  • DJ_Jamba Profile Picture
    2,837 Super User 2025 Season 2 on at

    Cool 😎 Glad it's sorted!
    d(-_-)b

  • MisterDon Profile Picture
    14 on at

    @DJ_Jamba- it looks like you headphones are going to give you a sore left ear d(-_-)b <---

  • DJ_Jamba Profile Picture
    2,837 Super User 2025 Season 2 on at

    too late pal!
    🤣

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard