Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Syntax Highlighting in formula

(0) ShareShare
ReportReport
Posted on by

Hi all,

I am using this formula in a Flow.

 

PowerAutomate does not show a failure during creating the flow but in runtime it says that sub should have 2 parameters but has 3.

 

 

 

div(sub(ticks(utcNow('yyyy-MM-dd')),ticks(formatDateTime(variables('nextTermin'),'yyyy-MM-dd')),864000000000))

 

 


My question:

Is there a way to copy the formular to Visual Studio Code (or a different editor) so that I can have Syntax Highlighting to investigate the error? Must have something to do with parantheses I think...

(Edit: of course I know how to copy the formula 😉 My problem is: how to save so that syntax highlighting is active? What language to choose or is there an addon for Visual Studio Code?)

Thank you!

  • smadep Profile Picture
    96 on at
    Syntax Highlighting in formula
    @Chriddle, still looks nicer that way ;-)
    but of course - indentation for the rescue - that's best practice anyway for "more complex" expressions
     
  • Chriddle Profile Picture
    7,793 Super User 2025 Season 1 on at
    Syntax Highlighting in formula
    I always write expressions with line breaks and indentations.
    This way I can immediately see what is going wrong.
     
    E.g.
    div(
    	sub(
    		ticks(
    			utcNow('yyyy-MM-dd')
    		),
    		ticks(
    			formatDateTime(
    				variables('nextTermin'),
    				'yyyy-MM-dd'
    			)
    		),
    		864000000000
    	)
    )
     
  • smadep Profile Picture
    96 on at
    Syntax Highlighting in formula
    I found this VS Code extension
    still a bit buggy, but it helps
     
  • RK-23070616-0 Profile Picture
    on at
    Re: Syntax Highlighting in formula

    Ah! That´s great!
    Thank you! 👍👌

  • Verified answer
    manuelstgomes Profile Picture
    6,625 on at
    Re: Syntax Highlighting in formula

    Awesome!! Well done! 🙂

     

    I open a "Plain Text" and put the cursor near the parenthesis. VS Code will do it for you.

    Here's my VS Code configuration.

    Screenshot_2021-02-01_at_10_59_23.jpg

     

     

    Please don't forget to mark "Accept as Solution" so that other people here can benefit from it.

     

    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

    Cheers
    Manuel

  • RK-23070616-0 Profile Picture
    on at
    Re: Syntax Highlighting in formula

    Thank you!
    You helped me very much with the parenthesis - it worked!
    But can you tell me how do you use Visual Studio Code so that the parenthesis are highlighted correctly?
    If I paste it there the text is just white.

  • manuelstgomes Profile Picture
    6,625 on at
    Re: Syntax Highlighting in formula

    Hi @der_cosmicyes 

     

    VS Code can help a little in your problem, highlighting the parenthesis and where they correspond. As you can see, there are 3 parameters on the sub.

    Screenshot_2021-02-01_at_09_04_52.jpg

     

    Regarding your issue, indeed, there's an issue with the parenthesis. You can validate it:

    Screenshot_2021-02-01_at_09_04_45.jpg

     

    Not what you want. Here's the correct sequence.

    Screenshot_2021-02-01_at_09_06_06.jpg

     

    Can you please check if and let me know if you have any questions?

     

    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

    Cheers
    Manuel

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 566 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 516 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 492