Skip to main content

Notifications

Community site session details

Community site session details

Session Id : ORUsqD5EehSdnNTHodMil9
Power Automate - Building Flows
Unanswered

How to select the last line of a text content ?

Like (0) ShareShare
ReportReport
Posted on 4 Jan 2018 11:09:30 by

Hi there I cannot figure out how to extract the last line of a text content, anyone knows how to solve this please?

I've tried to use the last() formula

Flow-lastline.png

but it fails because file content is type of Object instead of table/string ...2018-01-04 12 06 26.png

 

 

 

  • slyuso Profile Picture
    106 on 14 Feb 2018 at 21:58:27
    Re: How to select the last line of a text content ?

    This does not work

  • v-micsh-msft Profile Picture
    on 31 Jan 2018 at 10:47:39
    Re: How to select the last line of a text content ?

    Hi @Anonymous,

     

    To Split the New line, you may take a try with the code below:

    split('a;b;c','
    ')

     

    See if this would make it work.

     

    Regards,

    Michael

     

  • Community Power Platform Member Profile Picture
    on 31 Jan 2018 at 09:00:04
    Re: How to select the last line of a text content ?

    HI @v-micsh-msft and @v-yamao-msft, I thought this was the goal of the CreateArray(outputs('compose')) formula .... What if I can t add a separator in the input file ? Can I split file on CR/LF sĂ©parator ? maybe \n\r ??

    Seems to me there should be a built-in formula or activity that transform file content to array, especially if Flow is designed for non developpers people...

    Regards, 

    LoĂŻc

  • v-micsh-msft Profile Picture
    on 31 Jan 2018 at 02:46:55
    Re: How to select the last line of a text content ?

    Hi @Anonymous,

     

    You didn't miss anything.

    What Mabel means is that first you should build an array for your Text content.

    If there is no array, then the whole Text content would be considered as a single string.

    To create an array for each line, we could workaround this with the Split() function.

    For example:

    split('a;b;c',';')

    This would return the following Array:

    ["a", "b", "c"]

    Please consider add a separator at the end of each line, make sure this character is different from characters within the Text content.

    Then you should be able to use the Last function to get the Last line.

     

    Regards,

    Michael

  • Community Power Platform Member Profile Picture
    on 22 Jan 2018 at 10:13:34
    Re: How to select the last line of a text content ?

    Hi Mabel Mao thank you for your reply. I tried yout suggestion but last function still send me the whole array instead of the last line. Did I missed something ?2018-01-22 11 09 58.png

     

    2018-01-22 11 11 11.png

     

  • v-yamao-msft Profile Picture
    on 05 Jan 2018 at 07:36:06
    Re: How to select the last line of a text content ?

    Hi Loic,

     

    The error message says that the function last expects an array, however, the return value of action “Get file content” is binary.


    Please consider using the actions of Variables to convert the return value of Get file content to an array.


    In the action Set variable, use the function createarray to create an array from the parameters.

    3.PNG

     

    Please take this for a reference. Please feel free reply if you need more help.

     

    Best regards,
    Mabel Mao

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,745 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,091 Most Valuable Professional

Leaderboard