Forum Discussion

NanaBar's avatar
NanaBar
Copper Contributor
Dec 29, 2020

JSON formatting lookup column with multiple values

I am new to JSON formatting a column. In a SharePoint online list I have a lookup column that permits multiple values from the Document ID column from a document library. Three other columns are also brought in, one of which is date. 

 

Without applying any JSON formatting, the lookup column itself listing the multiple Document IDs displays just fine with separate lines. However, each of the multiple values in he other three other columns that are brought in with the lookup column do no display on a new line. Rather, they displayed with a semi-colon between them. This is less than ideal. I would like to format each of the multiple values to display on a new line. I have attempted to use various JSON examples without any luck. 

 

Can someone please help with an example for JSON formatting the lookup column and the three other columns brought in with it?

 

Thank you

4 Replies

  • Martin-Coupal's avatar
    Martin-Coupal
    Steel Contributor

    NanaBar , look at this example:

    Complex HTML elements formatting

     

    You will need to define column formatting for each of your 3 multiple values columns. Basically you need to use the foreach attribute that can define, for example, a div for each value (using the children attribute).

     

    Hope this help.

    • watsonag's avatar
      watsonag
      Copper Contributor

      Martin-Coupal 

       

      I'm trying this same thing.  I'm concerned the "forEach" function doesn't work on additional columns that are imported along with a Lookup column.

       

      Interested to hear if anyone has a solution.

      • watsonag's avatar
        watsonag
        Copper Contributor

        Okay, so it looks like the additional columns that pull from the other list treat their contents as a single string with semicolons distributed throughout. It does not treat them as an array.

        So how do you take a string with semicolons and turn it into an iterable array?

        That's not a feature yet.  Go upvote this feature recommendation if you want it to be added.

        https://sharepoint.uservoice.com/forums/329220-sharepoint-dev-platform/suggestions/35436979-json-formatting-add-parse-and-split-operand#comments

Resources