跳至內容
選單
此問題已被標幟
2 回覆
5458 瀏覽次數

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
6084
0
10月 23
1822
0
12月 22
2726