Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
Answered

String to Table with Multiple columns

(0) ShareShare
ReportReport
Posted on by 8

Hi Everyone,

I need help to convert string to Table format, I have a list which is storing last modified values. So i am fetching values against each item, string is in following format

"[{\"Change Date\":\"2023-01-28\",\"Change Field\":\"Description\",\"Previous Value\":\"<p>123 Abcdefghi</p>\",\"Changed Value\":\"<p>123 Abcdefghij1</p>\",\"Who Performed\":\"User1\"}]

[{\"Change Date\":\"2023-01-28\",\"Change Field\":\"Description\",\"Previous Value\":\"<p>123 Abcdefghij1</p>\",\"Changed Value\":\"<p>123 Abcdefghij12</p>\",\"Who Performed\":\"User2\"}]

[{\"Change Date\":\"2023-01-28\",\"Change Field\":\"Description\",\"Previous Value\":\"<p>123 Abcdefghij12</p>\",\"Changed Value\":\"<p>123 Abcdefghij123</p>\",\"Who Performed\":\"User 3\"}]

[{\"Change Date\":\"2023-01-28\",\"Change Field\":\"Title\",\"Previous Value\":\"<p>12abcdefgh</p>\",\"Changed Value\":\"<p>12abcdefgh1</p>\",\"Who Performed\":\"User 1\"}]"

 

Change DateFieldPrevious valuesChanged ValuesModied
2023-01-28Description123 Abcdefghi1123 Abcdefghij12User 1
2023-01-28Description123 Abcdefghi123 Abcdefghi1User 2

 

Tried with split & forall functions but didn't succeed. Can someone help me?.

 

Thanks 🙂

@RezaDorrani , @WarrenBelz 

  • WarrenBelz Profile Picture
    147,161 Most Valuable Professional on at
    Re: String to Table with Multiple columns

    @BhagvanReddy1 ,

    When I copied your code from your Post, there was a line between each of the records, meaning two hard returns

    Char(10) & Char(10)

    which I then replaced with a pipe | which is used as the delimiter between the records

     Char(10) & Char(10),
     "|"

    and then to split them

    Split(
     wTable,
     "|"
    )

    So whatever is between your records (I suspect a single Char(10) ) needs to go in the second code above.

     

  • BhagvanReddy1 Profile Picture
    8 on at
    Re: String to Table with Multiple columns

    I found it there was space in between each array element, apart from that didn't find anything, Is that the one?

  • WarrenBelz Profile Picture
    147,161 Most Valuable Professional on at
    Re: String to Table with Multiple columns

    @BhagvanReddy1 ,

    I will give you a clue which I will help if you do not find it - I simply copied the code from your post and worked with that. Have a look at the difference in spacing between records on what you have posted now and what I copied (it is in the top of my solution post) - there is only one thing you need to change.

  • BhagvanReddy1 Profile Picture
    8 on at
    Re: String to Table with Multiple columns

    From SharePoint i am fetching details of the record, the column which stores data is an multiline plain text,

    BhagvanReddy1_0-1675025535064.png

    here is my formula on App start

    BhagvanReddy1_1-1675025618572.png

    find On screen visible property

    BhagvanReddy1_2-1675025701729.png

    i can see only single value of the above result

    BhagvanReddy1_3-1675025757212.png

    Did i miss something?. Let me know

     

     

     

     

     

  • WarrenBelz Profile Picture
    147,161 Most Valuable Professional on at
    Re: String to Table with Multiple columns

    @BhagvanReddy1 ,

    I assume you have sorted this - my model below with the input (from a field in my test list) at the top and the output at the bottom.

    WarrenBelz_2-1674986695948.png

     

     

     

  • BhagvanReddy1 Profile Picture
    8 on at
    Re: String to Table with Multiple columns

    Thanks 😃 for the quick reply, whereas above functionality will return single value of it in table format. where as it should return multiple values. 

     

    ClearCollect(colTable,
    With(
    {
    HistoryTable:
    Substitute(
    Substitute(
    Substitute(
    Substitute(
    Substitute(
    Substitute(
    Substitute(
    Substitute(
    Substitute(
    VarResult,
    "{",
    ""
    ),
    "}",
    ""
    ),
    "\",
    ""
    ),
    "<p>",
    ""
    ),
    "</p>",
    ""
    ),
    """",
    ""
    ),
    Char(10) & Char(10),
    "|"
    ),
    "[",
    ""
    ),
    "]",
    ""
    )
    },
    ShowColumns(
    AddColumns(
    Split(
    HistoryTable,
    "|"
    ),
    "Change Date",
    Last(
    Split(
    Index(
    Split(
    Result,
    ","
    ).Result,
    1
    ).Result,
    ":"
    )
    ).Result,
    "Change Field",
    Last(
    Split(
    Index(
    Split(
    Result,
    ","
    ).Result,
    2
    ).Result,
    ":"
    )
    ).Result,
    "Previous Value",
    Last(
    Split(
    Index(
    Split(
    Result,
    ","
    ).Result,
    3
    ).Result,
    ":"
    )
    ).Result,
    "Changed Value",
    Last(
    Split(
    Index(
    Split(
    Result,
    ","
    ).Result,
    4
    ).Result,
    ":"
    )
    ).Result,
    "Who Performed",
    Last(
    Split(
    Index(
    Split(
    Result,
    ","
    ).Result,
    5
    ).Result,
    ":"
    )
    ).Result
    ),
    "Change Date",
    "Change Field",
    "Previous Value",
    "Changed Value",
    "Who Performed"
    )
    )
    )

  • Verified answer
    WarrenBelz Profile Picture
    147,161 Most Valuable Professional on at
    Re: String to Table with Multiple columns

    @BhagvanReddy1 ,

    Sunday morning and noting more productive to do, so I built a model and the this works in my test

    With(
     {
     wTable: 
     Substitute(
     Substitute(
     Substitute(
     Substitute(
     Substitute(
     Substitute(
     Substitute(
     Substitute(
     Substitute(
     YourTextHere,
     "{",
     ""
     ),
     "}",
     ""
     ),
     "\",
     ""
     ),
     "<p>",
     ""
     ),
     "</p>",
     ""
     ),
     """",
     ""
     ),
     Char(10) & Char(10),
     "|"
     ),
     "[",
     ""
     ),
     "]",
     ""
     )
     },
     ShowColumns(
     AddColumns(
     Split(
     wTable,
     "|"
     ),
     "Change Date",
     Last(
     Split(
     Index(
     Split(
     Result,
     ","
     ).Result,
     1
     ).Result,
     ":"
     )
     ).Result,
     "Change Field",
     Last(
     Split(
     Index(
     Split(
     Result,
     ","
     ).Result,
     2
     ).Result,
     ":"
     )
     ).Result,
     "Previous Value",
     Last(
     Split(
     Index(
     Split(
     Result,
     ","
     ).Result,
     3
     ).Result,
     ":"
     )
     ).Result,
     "Changed Value",
     Last(
     Split(
     Index(
     Split(
     Result,
     ","
     ).Result,
     4
     ).Result,
     ":"
     )
     ).Result,
     "Who Performed",
     Last(
     Split(
     Index(
     Split(
     Result,
     ","
     ).Result,
     5
     ).Result,
     ":"
     )
     ).Result
     ),
     "Change Date",
     "Change Field",
     "Previous Value",
     "Changed Value",
     "Who Performed"
     )
    )

    and in case you are wondering, you cannot create field names dynamically.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

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 > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 87 Most Valuable Professional

#2
mmbr1606 Profile Picture

mmbr1606 71 Super User 2025 Season 1

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 65 Super User 2025 Season 1

Overall leaderboard