英文:
How to write a json formula
问题
以下是翻译好的内容:
"formula": {
"operation": "*",
"left": {
"operation": "-",
"left": {
"operation": "value",
"type": "custom_fields",
"value": "last_price"
},
"right": {
"operation": "value",
"type": "custom_fields",
"value": "cost"
}
},
"right": {
"operation": "value",
"type": "const",
"field": 100
}
}
英文:
I am writing a json formula to calculate a custom value, need it to look like this:(last_price - cost) / last_price * 100. I am a little confused on where to put left and right parts of the calculation, like what should go first - "100" or "/last_price"
I wrote this, which makes it into (last_price-cost)*100 I guess:
"formula": {
"operation": "*",
"left": {
"operation": "-",
"left": {
"operation": "value",
"type": "custom_fields",
"value": "last_price"
},
"right": {
"operation": "value",
"type": "custom_fields",
"value": "cost"
}
},
"right":{
"operation": "value",
"type": "const",
"field": 100
答案1
得分: 0
朋友建议将公式更改为(1 - 成本 / 最后价格)* 100,这样我更容易理解。
英文:
Friend recommended to change formula to (1 - cost / last_price) * 100, which makes it much easier for me to put into.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论