跳至内容
菜单
此问题已终结
2 回复
5454 查看

Hi friends,

I have a char field,which has formula for calculations (char field value is 0.17*(@tw)+0.6*(@tw-500) ).Here i need to replace @tw with some float value and do calculations and need to return float value.How to achieve this.

Thanks in advance.

形象
丢弃
编写者

it shows invalid syntax error on .20*@tw

use it without @

just 0.20*tw

its working

最佳答案

hello vadivel

you can do it with "eval" method

def formula( self ):     
    tw=10 #your value
  return eval ('0.17*(tw)+0.6*(tw-500)')

Good Luck


形象
丢弃
相关帖文 回复 查看 活动
1
9月 19
4082
0
4月 24
1971
4
11月 23
6083
0
10月 23
1822
0
12月 22
2726