Forum Discussion
Sharepoint/Lists - Toggle if statement
- Dec 13, 2021
Sportback I am able to update choice column as well. Here's JSON I am using:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "customRowAction": { "action": "setValue", "actionInput": { "Paye": "=if([$Paye] == 'OUI', 'NON', 'OUI')" } }, "children": [ { "elmType": "button", "attributes": { "class": "ms-bgColor-purple--hover ms-fontColor-white--hover ms-fontColor-gray140 ms-bgColor-gray30" }, "txtContent": "PAYER", "style": { "padding": "2px 15px 13px 15px", "height": "23px", "border": "none", "border-radius": "8px", "cursor": "pointer", "box-shadow": "rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px" } } ] }Output:
Choice column settings:
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
Hi ganeshsanap
In fact, that works fine with type "Yes/No", but I want to use type "Choice" and that it does not work . That is not a problem with column name, because that it works when statement is "false"
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"customRowAction": {
"action": "setValue",
"actionInput": {
"Pay_x00e9_": "=if([$Paye] == 'OUI', 'NON', 'OUI')",
"test": "=if([$test] == true, false, true)",
"Payerpar": "@me"
}
},
"children": [
{
"elmType": "button",
"attributes": {
"class": "ms-bgColor-purple--hover ms-fontColor-white--hover ms-fontColor-gray140 ms-bgColor-gray30"
},
"txtContent": "PAYER",
"style": {
"padding": "2px 15px 13px 15px",
"height": "23px",
"border": "none",
"border-radius": "8px",
"cursor": "pointer",
"box-shadow": "rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px"
}
}
]
}
Sportback I am able to update choice column as well. Here's JSON I am using:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"customRowAction": {
"action": "setValue",
"actionInput": {
"Paye": "=if([$Paye] == 'OUI', 'NON', 'OUI')"
}
},
"children": [
{
"elmType": "button",
"attributes": {
"class": "ms-bgColor-purple--hover ms-fontColor-white--hover ms-fontColor-gray140 ms-bgColor-gray30"
},
"txtContent": "PAYER",
"style": {
"padding": "2px 15px 13px 15px",
"height": "23px",
"border": "none",
"border-radius": "8px",
"cursor": "pointer",
"box-shadow": "rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px"
}
}
]
}
Output:
Choice column settings:
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
- SportbackDec 13, 2021Copper ContributorThanks, the problem happening with special characters in name of column.