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

Hello Community,

I stumbled over the following. I have an input named BNS (for bonus).

And I have a Phyton condition: result = inputs.BNS.amount > 0

and I tried the second version of it: result = inputs.BNS.amount is not None 

Based on whether it is true the calculation should activate. 

When there is an BNS input in a payroll slip, everything works. If there is no BNS input, i get the error in subject. Please, advise how to skip this rule execution when there is no BNS input

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hello,

You can use try and except

example

try:

     result = inputs.BNS.amount
except:

     result = 0

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi

make the conditions based on = always true

computation:

Amount Type = python code

python code = result = inputs.BNS1.amount * 1


and in the inputs tap add

description= Bounce

Code= BNS1


Hope that help


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
พ.ค. 25
916
1
มี.ค. 25
1098
0
ก.พ. 25
1282
1
ธ.ค. 24
1779
0
พ.ย. 24
108