0

@Matiur Rahman

Here is a copy of the columns I am working with, which reside in a document library. The scenario is to combine values from each of these fields, no matter what the user selects and put them into a single SharePoint column. Ideally the combined column would be in the same library. Is there an easy way to do this?

enter image description here

3
  • Let me take a look into it. Will the combined values be delimited by comma or any other char? I'm sure it can be done using Power Automate Commented Feb 23, 2021 at 3:01
  • @MatiurRahman - Yes values will be delimited by commas when they are pulled from the same column, but combined by underscore as a whole. Commented Feb 23, 2021 at 15:37
  • As you can see in the screenshot, in Modern view, multi-select values are already delimited by a comma and that's why I used '; ' in the Combined column to separate column values Commented Feb 23, 2021 at 16:04

2 Answers 2

0

I think you can accomplish this using JSON column formatting. Try the below JSON formatting and let me know. (Note: You could use Power Automate, but that is not needed for simple solution)

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "txtContent": "=[$Category] + '; ' + [$DataSource] + '; ' + [$States] + '; ' + [$B2B] + '; ' + [$Health] + '; ' + [$Plans] + '; ' + [$Years] + '; ' + [$Months] + '; ' + [$Element]"
}

You can read more on JSON column formatting at here

Here is the output screenshots

(Column values are separated with '; ')

enter image description here

How to add JSON Formatted Column


  1. From modern view or from List/Library settings, add a Singe line of text column

enter image description here

  1. In the modern view, Click on the column added in step 1 and then select Format this column as shown in the screenshot below

enter image description here

  1. A new window - Format [Name of the Column] Column - will open. Click Advance mode towards the bottom of the window

  2. Replace the JSON with yours in the text box under "Change the display .." and then click Save.

Note: If the JSON is not formatted correctly, Save button is disabled

5
  • Can you add screen shots of how you added the JSON column to SharePoint. This is the result I am looking to use. But I am not understanding how to add JSON to the column. I added it a a calculated column, but that is not working. I'm going to try adding it to the box that's in the column settings. Commented Feb 23, 2021 at 17:38
  • Updated my response. Let me know if you have any questions Commented Feb 23, 2021 at 18:32
  • Yes, I added the JSON just as you provided, and I added it according to your instructions. And you are right... it is not formatting correctly. It might be too much to ask the company's IT team to turn on the SAVE button. I will ask and see what they tell me. They keep telling us to use SP out of the box, but there's so much more that can be done. Thank you so very much! Commented Feb 23, 2021 at 21:13
  • You are AWESOME! Thanks again! Commented Feb 23, 2021 at 21:30
  • If my response helped you, please mark the question as answered. Let me know if you still have questions on this. Commented Feb 23, 2021 at 21:39
0

You could use the follwoing JSON formatting.

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "txtContent": "=[$Category] + '; ' + [$DataSource] + '; ' + [$States] + '; ' + [$B2B] + '; ' + [$Health] + '; ' + [$Plans] + '; ' + [$Years] + '; ' + [$Months] + '; ' + [$Element]"
}

enter image description here

1
  • I will try the JSON too. Commented Feb 23, 2021 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.