Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
5451 มุมมอง

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


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.ย. 19
4082
0
เม.ย. 24
1971
4
พ.ย. 23
6082
0
ต.ค. 23
1821
0
ธ.ค. 22
2725