SOLVED

SP Form Header Json Issue

Brass Contributor

Hello, I am trying to add some numbers from several choice columns in the form header to display a total. When I try to add them it just put both numbers instead of performing the addition.

                    "elmType": "div",
                    "txtContent": "='Overall Score: '+([$Sort_x002d_1_x002e_Misc_x002e_eq]+[$Sort_x002d_2_x002e_Itemsareprese])"

 

Why does this output Overall Score : 44 instead of Overall Score : 8

 

Thanks

2 Replies
best response confirmed by SG523 (Brass Contributor)
Solution

@SG523 Try using this:

 

"txtContent": "='Overall Score: ' + toString(Number([$Sort_x002d_1_x002e_Misc_x002e_eq]) + Number([$Sort_x002d_2_x002e_Itemsareprese]))"

 

For more information about functions used & their syntax, check: JSON formatting operators  


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.

Thank you for the great response! That worked perfectly and now I understand why thanks to the link!
1 best response

Accepted Solutions
best response confirmed by SG523 (Brass Contributor)
Solution

@SG523 Try using this:

 

"txtContent": "='Overall Score: ' + toString(Number([$Sort_x002d_1_x002e_Misc_x002e_eq]) + Number([$Sort_x002d_2_x002e_Itemsareprese]))"

 

For more information about functions used & their syntax, check: JSON formatting operators  


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.

View solution in original post