Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
5695 Lượt xem

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.

Ảnh đại diện
Huỷ bỏ
Tác giả

it shows invalid syntax error on .20*@tw

use it without @

just 0.20*tw

its working

Câu trả lời hay nhất

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


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 9 19
4248
0
thg 4 24
2188
4
thg 11 23
6383
0
thg 10 23
2100
0
thg 12 22
2926