Conditional Calculation


#1

Hi, Nik

I’ve been hunting for the right syntax to use for an IF type calculation.

I want to be able to say if {custom-field} >30 return a value of 4, otherwise return a value of 0.

I can then add that value to the total risk score.

How do I do that?

Thanks, Trudy


#2

Hi @Trudy

Would this work?

You can update custom fields if a specific condition is met.

Nik


#3

Maybe? I’ve tried it and it sort of works, but not fully.

I am adding up the points for a sub-section (and because it’s a sub-section, I need to define what to add together as part of the calculated custom field, right?) and then (as I understand it) I am telling LH to then add in more points to that sub-section’s score if the criteria I set up are met.

Or do I have to set it up so that it works that way for the whole sub-section (the way you’ve suggested), i.e. use a decision node outcome to update a custom field?

Cheers, Trudy


#4

@Trudy,

I’m not sure I’m fully understanding this so please correct me if I’m wrong.

Yes this is correct. I’m assuming this update of field is ONE number that is used in a calculated field.

In this case you’ll use a calculation field.

Side note: If you display a calculated field, then LH automatically executes the calculation. There are times when you want to perform a calculation (say an intermediate calculation), then you’ll need to do this…

Why? Unless a field is displayed, LH has no way of knowing when to execute the calculation so add the field to a text editor with display:none attribute.

Nik