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

Crating List

(0) ShareShare
ReportReport
Posted on by 90

Hi All, 

I am trying to extract(Using PARSE text action) the customer details alone from this example and trying to create a List for each customer. Kindly help.

Ex:

Accepted Claims:0      Charges:0.00

Rejected Claims:0       Charges:0.00

----------------------------------------

Customer Name: John,Test1      Age:23

City: Sun                                     Date:4/22/24

------------------------------------------

Customer Name: Krish, Test2     Age:33

City: Moon                                  Date:8/9/23

------------------------------------------

Customer Name: Sam, Test3       Age:24

City: Sun                                     Date:3/4/24

-----------------------------------------------

 

 

The "Parse Text" output should be:

Customer Name: John,Test1      Age:23

City: Sun                                     Date:4/22/24

------------------------------------------

Customer Name: Krish, Test2     Age:33

City: Moon                                  Date:8/9/23

------------------------------------------

Customer Name: Sam, Test3       Age:24

City: Sun                                     Date:3/4/24

-----------------------------------------------

From this output i like to create a list for each customer.

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

    Try this out:
    Here are the first results:

    MichaelAnnis_0-1713827315355.png

    SET Folder TO $'''[YOUR FILE PATH GOES HERE, NO BRACKETS]'''
    SET File TO $'''[YOUR FILENAME.EXT GOES HERE, NO BRACKETS]'''
    File.ReadTextFromFile.ReadText File: $'''%Folder%\\%File%''' Encoding: File.TextFileEncoding.UTF8 Content=> FileContents2
    Text.SplitText.SplitWithDelimiter Text: FileContents2 CustomDelimiter: $'''------------------------------------------''' IsRegEx: False Result=> CustomerSections
    LOOP FOREACH CurrentItem IN CustomerSections
    # Extract Name
    Text.ParseText.ParseForFirstOccurrence Text: CurrentItem TextToFind: 'Customer Name: ' StartingPosition: 0 IgnoreCase: False OccurrencePosition=> NameStart
    # >Find the first double space after the name start
    Text.ParseText.ParseForFirstOccurrence Text: CurrentItem TextToFind: $'''%' '%''' StartingPosition: NameStart + 15 IgnoreCase: False OccurrencePosition=> NameEnd
    # >Extract Customer Name using the start and end positions found
    Text.GetSubtext.GetSubtext Text: CurrentItem CharacterPosition: NameStart + 15 NumberOfChars: NameEnd - (NameStart + 15) Subtext=> CustomerName
    # Extract Age
    Text.ParseText.ParseForFirstOccurrence Text: CurrentItem TextToFind: 'Age:' StartingPosition: 0 IgnoreCase: False OccurrencePosition=> AgeStart
    # >Find the end of the line after 'Age:'
    Text.ParseText.ParseForFirstOccurrence Text: CurrentItem TextToFind: $'''
    ''' StartingPosition: AgeStart IgnoreCase: False OccurrencePosition=> AgeEnd
    # >Extract Age using the position after 'Age:' to the end of the line
    Text.GetSubtext.GetSubtext Text: CurrentItem CharacterPosition: AgeStart + 4 NumberOfChars: AgeEnd - (AgeStart + 4) Subtext=> CustomerAge
    # Extract City
    Text.ParseText.ParseForFirstOccurrence Text: CurrentItem TextToFind: 'City: ' StartingPosition: 0 IgnoreCase: False OccurrencePosition=> CityStart
    # >Find the first double space after the city start
    Text.ParseText.ParseForFirstOccurrence Text: CurrentItem TextToFind: $''' ''' StartingPosition: CityStart + 6 IgnoreCase: False OccurrencePosition=> CityEnd
    # >Extract City using the start and end positions found
    Text.GetSubtext.GetSubtext Text: CurrentItem CharacterPosition: CityStart + 6 NumberOfChars: CityEnd - (CityStart + 6) Subtext=> CustomerCity
    # Extract Date
    Text.ParseText.ParseForFirstOccurrence Text: CurrentItem TextToFind: 'Date:' StartingPosition: 0 IgnoreCase: False OccurrencePosition=> DateStart
    # >Find the end of the line after 'Date:'
    Text.ParseText.ParseForFirstOccurrence Text: CurrentItem TextToFind: $'''
    ''' StartingPosition: DateStart IgnoreCase: False OccurrencePosition=> DateEnd
    # >Extract Date using the position after 'Date:' to the end of the line
    Text.GetSubtext.GetSubtext Text: CurrentItem CharacterPosition: DateStart + 5 NumberOfChars: DateEnd - (DateStart + 5) Subtext=> CustomerDate
    Display.ShowMessageDialog.ShowMessage Title: $'''Results''' Message: $'''Name:%CustomerName%
    Age:%CustomerAge%
    City:%CustomerCity%
    Date:%CustomerDate%''' Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed
    END

    Good Luck!


    I created this with the help of my ChatGPT - PAD Assistant.  If anyone has a paid ChatGPT subscription and would like access, please message me for more details.

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Oh, delete the message box...i only added that to show you the results.

    Regards,

     

    Mike

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