JSON Conditional formatting for list view colum

Brass Contributor

Hi SharePoint Users,

I've recently migrated some contents from a legacy system to SharePoint list. There is a drop down 'WareHouse' having the 7 different text values. But in the legacy system these were mapped to numbers. And the migrated documents show number in the list view. Using PowerApps, i have modified the drop down to map the numbers to the correct text values in the Forms.

Attached screenshot for further details.

 

Is their a way using JSON formatting to map the numbers to a text value in the list view.

E.g. 

if(@currentField == '1','DropdownText value 1')

2 Replies

Unless I've misintepreted what you want you don't need to tangle with JSON for this. As you are already using PowerApps for the form you just need to add an extra text input control that saves the text value back to the SharePoint column.

I've done a very simple example in the image below. The data in the 3rd dropdown, ddField, just looks up the number of a farmer's field, 1 - 7 from a separate list, but he wants to save the name of the field. So the number from the dropdown is saved to a text input box called dataFieldno where the default value is ddField.Selected.Value

We then add another text box called dataField that uses multiple ifs in the default value as follows:
If(dataFieldno.Text="1","Top Field",If(dataFieldno.Text="2","Upper Field",If(dataFieldno.Text="3","Mid Levels",
If(dataFieldno.Text="4","Home Field",If(dataFieldno.Text="5","Garden Field",If(dataFieldno.Text="6","Nicol Field","Low Field"))))))

Then in the datacard the Update box is set to dataField.Text. 

So although you are selecting a number from the dropdown, it is the text that gets saved back to the list.

I'm sure there are better/shorter ways of doing this but it was just a quick example. If you want any more info or the detailed steps just let me know.

Rob
Los Gallardos

powerappsForm1.png

 

spForm.png

 

@RobElliottThanks a lot for the reply. But my issue is only with the migrated documents. The one created newly have the dropdowns populated correctly.

There are around 500 items in the list. I would prefer the JSON method as it would update the values at one go for all the items.