web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / String to Table with M...
Power Apps
Unanswered

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 

I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    @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

  • BhagvanReddy1 Profile Picture
    8 on at

    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"
    )
    )
    )

  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    @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

    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
    153,034 Most Valuable Professional on at

    @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

    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
    153,034 Most Valuable Professional on at

    @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.

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard