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 Functions in Var...
Power Automate
Answered

Using Functions in Variables within Power Automate Desktop

(1) ShareShare
ReportReport
Posted on by 25

Cheers,

 

I tried to dig up the internet without success for finding a solution to use (for example) text functions when assigning value to a variable.


At a 'set variable' action I have set: NewVar to 210121 (the date of the query). In the other stage I would like to set variable YearVar to something like "20" & Left(%NewVar%, 2). Unfortunately nothing like that seems to be working.

Is there a way to use functions within variables or inputs to actions in any fashion - apart from using the 'Get subtext' action? In a software where you can scrape whole tables from the web with css identification in a few clicks, I think it would be really lame to use a separate action for a simple text function.

 

PLEASE DO NOT COME UP WITH SOMETHING LIKE WHY I NEED THAT - bc I could use another tools or the whole thing is superfluous in the process, as I am still trying to find out what this software can do - because of the somewhat inappropriate documentation.

 

Thanks,
JD

I have the same question (0)
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @JDofficial ,

     

    * Convert the number to text

    * Use "Get Subtext" action to get subtext

    * Then  add 20 infront of the subtext output

     

    Hope this helps:)

     

     

    sakula1996_0-1611339910952.png

     

    sakula1996_1-1611339936196.png

    sakula1996_2-1611339956206.png

     

    sakula1996_3-1611339970200.png

     

     

  • JDofficial Profile Picture
    25 on at

    Thank you @Anonymous, but my question was:

    "Is there a way to use functions within variables or inputs to actions in any fashion - apart from using the 'Get subtext' action?"

     

    Since you used it, I cannot accept it as a solution. I am completely aware of the opportunity of doing this (see my original post), but I find pretty awkward to do something similar in 3 actions instead of one line of code.

  • Verified answer
    Rkmatieda Profile Picture
    77 on at

    Hi @JDofficial ,

    I totally agree with your view that if in a sophisticated programming language some logic/code can be incorporated with just 1 line of code, why it would not be possible to have it in another language/platform? As of now, in PAD it is not possible to call those ".net framework" based functions straight away. You can call it serious limitation/restriction.

     

    An alternative to this can be activites like "Run VB Script" or "Run Python script", in which you can writedown really detailed piece of code in just 1 instruction.

     

    Also in my opinion, having some restrictions in platform could be well though off by the developers of it. In case of PAD, I have observed one thing is that the chances error/failure of a piece of automation are significantly less compared to any other platform. Because your code is made up from only those activity allowed by software and not from user preffered library dependent functions/instructions. The more free environment it is the less error proofing done at design time or more error checking has to be done at run time. and at run time the chances of error/exception increases lot so the chances of execution break up in run time are higher.

     

    I have been using other industry leader RPA tools since now almost 3 years. and one thing i have experienced is that you need to invest lot of time behind checking and testing of automation before deploymebt if your developmenet environment is so-called Open. in case of PAD this time could be significantly lower.

     

    This doesn't mean that I don't want any changes or addition in platform. There are lot of improvement scope for it, which are being mentioned on the forum like this.

     

    So the bottom line could be just find a way to actualize your code within the restriction of the software platform and then compare one platform with another platform in terms of performance.

  • JDofficial Profile Picture
    25 on at

    Hi @Rkmatieda,

     

    Thank you for the ideas you have given - using Python or VBScript as an alternative. I find it is still not ideal, but better off having tons of actions that cannot be renamed and be put in context especially when automating more complex processes. As seemingly this is the best choice in the current framework I give you the credit for that.

     

    Your reasoning, which I think is pretty close to the developers' official one, is fair and for now we have to live with it - I really hope only for now - as future development is going to iron out these flaws.

     

    To reiterate: I also do think that PAD has really powerful tools like extract data from web page - but it is really dissonant that getting a subtext of a string is equally weighted as a process step to scraping a whole table. On the reliability part I find its behavior weird sometimes (like sometimes it does not run properly if an instance of a browser is not open yet) - but that is an other subject. In theory .NET is also developed by Microsoft, so I see no major challenge on the reliability here - the knowledge is within the organization. Strategically I deem there is a complete different story.

     

    Cheers,

    JD

  • wszreiber Profile Picture
    3 on at

    with date is method with math

    for example, if u wanna cut day number from 210121

    when day is last digits: (210121 - day from date) / 100   = 2101

     

    /vviesio

     

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 March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 608

#2
Valantis Profile Picture

Valantis 416

#3
11manish Profile Picture

11manish 348

Last 30 days Overall leaderboard