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 Automate
Answered

Finding a solution.

(0) ShareShare
ReportReport
Posted on by 74

Hi.

I have a new challenge and need some help. I have a folder and inside there is another subfolder

Atlantis1_0-1636572023796.png

My goal is to extract these numbers 17503481 and the second capture is A3-18 from the subfolder and store those as variables to use for other task.

I´ve tested with this.

Atlantis1_2-1636572818391.png

 

I used capture UI element with this operation and it capture the hold window and i don´t know a way to trim away other number or I wonder if it captures as a text instead. I need it to capture as a number. Thanks

 

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Get Subfolders in Folder to %Folders%

    For Each %CurrentItem% in %Folders%

    #assuming all subfolders have the same alphanumeric coding

    Get Subtext %CurrentItem.Name% from 0-8 to %FolderNumber%

    ReverseText %CurrentItem.Name% to %ReversedText%

    Get Subtext %ReversedText% from 0-5 to %FolderCode%

    Do something with %FolderNumber% and %FolderCode%  #if you need them all after exiting For Each, then create two lists before the for each and add them to the lists before End (for each).

    End (For Each)

     

     

     

     

  • VJR Profile Picture
    7,635 on at

    Hi @Atlantis1 

     

    Please use the in-built actions related to folders and subfolders.

    That will make it easier for you to read the names.

    VJR_0-1636630481473.png

     

    Regarding the extraction of text, (17503481 and the second capture is A3-18)

    - Is there a unique pattern to these names?

    - Do you want to always get the 8 characters from the left and 5 characters from the right?

    - Is it always going to be of this format? -> xxxxxxxx-xx-xx-xx

     

     

  • Atlantis1 Profile Picture
    74 on at

    Hi @VJR 

    Thanks again for your support. It seems like there is a pattern to these digit names. Pls see picture below.

    Atlantis1_0-1636652368064.png

    As you can see sometimes it is 7 digits sometimes 8 if you count until M word. I need to extract all those numbers start from the left side but without M word. Then as you see on the picture i need also A4-18 and C2-14.

    It would be great if you can take a screenshot of your test flow so it´s more easier for me to follow . Thanks again.

     

  • Atlantis1 Profile Picture
    74 on at

    Hi @MichaelAnnis 

    Thank you very much for looking at my challenges. I tried to follow your steps but got stuck at step 3 (Get Subtext) due to my lack of PAD knowleges.

    Atlantis1_1-1636653064398.png

    It would be great if you can post some screenshot for me to follow. As i mention to @VJR there is a pattern to these name. Plz see pic below.

    Atlantis1_2-1636653312165.png

    I need all those numbers from left side but without M word. And A4-18, C2-14 in the middle.

     

  • Verified answer
    MichaelAnnis Profile Picture
    5,727 Moderator on at

    You can split text using M as the custom delimiter to get the first value.

     

    As for the remaining, do another split by a hyphen delimiter and pull the 3rd and 4th values, then string them back together.

  • Verified answer
    VJR Profile Picture
    7,635 on at

    Hi @Atlantis1 

     

    There are multiple ways to achieve this.

     

    Copy/paste the below code into a blank PAD window, run and check the outputs shown in display box.

     

    SET InputStr TO $'''6759186M-21a-A4-18-3.6-CRC'''
    Text.SplitWithDelimiter Text: InputStr CustomDelimiter: $'''-''' IsRegEx: False Result=> TextList
    Text.Replace Text: TextList[0] TextToFind: $'''M''' IsRegEx: False IgnoreCase: False ReplaceWith: $'''%''%''' ActivateEscapeSequences: False Result=> var1
    Display.ShowMessage Message: var1 Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed
    Display.ShowMessage Message: $'''%TextList[2]%-%TextList[3]%''' Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed

     

  • Atlantis1 Profile Picture
    74 on at

    Hi @VJR 

    Almost there. Both the result is exactly what i need. The thing that needs to refine a little is instead of  manually 'set variable with case number' at the start of your flow i would like to find a way  to capture those digits itself  when i hit the run button.

    The reason is because a new case (folder) will appear and the old case will be manually deleted after processing so i when i hit run, the flow will automatically capture those number when the new one appears. This folder is a subfolder in a folder by the way. Hope i can make it clearer.

     

    I try to learn by understand the actions. But i have difficult to understand the defination of %TextList[2]%-%TextList[3]% in your flow. Can you clarify a little more.

  • Verified answer
    MichaelAnnis Profile Picture
    5,727 Moderator on at

    Inside of each CurrentItem loop, you want to Add the separate variables to a list, so it looks like this:

     

    Create List %FolderNumbers%

    Create List %FolderCodes%

    Get Subfolders in Folder to %Folders%

    For Each %CurrentItem% in %Folders%

    • Take VJRs actions to get the values
    • Add %Var1% to list %FolderNumbers%
    • Add %Var2% to list %FolderCodes%

    End (For Each)

     

    Now you have two text lists, one of the numbers and one of the code.

     

  • Verified answer
    VJR Profile Picture
    7,635 on at

    Hi @Atlantis1 ,

     

    Regarding your question - i have difficult to understand the defination of %TextList[2]%-%TextList[3]% in your flow. Can you clarify a little more.

     

    - TextList is an array variable returned after using split

    - Because arrays start with index 0, to access the 3rd element of the array you write %TextList[2]%

    - to access the 4th element of the array you write %TextList[3]%

    - So this (%TextList[2]%-%TextList[3]%) is written to add a hyphen between those two values as you wanted.

    - Refer below image for above points

     

    This is how Array TextList looks like after running the process

    VJR_0-1636772291049.png

     

     

     

    Secondly, Manually "set variable" was just to demonstrate.

    You have to read the folder names in a loop using the inbuilt action in PAD.

    @MichaelAnnis has shared a Pseudo logic. Please take a look.

  • Atlantis1 Profile Picture
    74 on at

    Hi @VJR and @MichaelAnnis 

    I now totally understand your flow @VJR . @MichaelAnnis flow is a little bit challenging for me cause it is a little more advance for me. I am still trying to recreate @MichaelAnnis suggestions and then combine with your solution. I think with both of these 2 ideas are what i am looking for. I am trying my best 😀 to put together a working flow. I certainly will reply and post more questions here. Thanks both of you.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 423

#2
11manish Profile Picture

11manish 308 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 177

Last 30 days Overall leaderboard