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

Announcements

News and Announcements icon
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 Moderator 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 Moderator 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 Moderator 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 Moderator 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 632

#2
Haque Profile Picture

Haque 458

#3
Valantis Profile Picture

Valantis 357

Last 30 days Overall leaderboard