1

I have 2 fields that I would like to check if their values are equal with "current_outstanding_balance" If so, it adds text to the field "current_outstanding_balance_check" . It's working when i add one var to loop. But i tried add more like, but it's not working. if(overduer && overdue == fieldNameForResult)

This is my code:

function(){
   var fieldNameForResult = thisPointer.entity.getValue('current_outstanding_balance');
   var overduer = thisPointer.entity.getValue('additional_personnel_costs');
   var overdue = thisPointer.entity.getValue('overdue');


   if(overduer && overdue == fieldNameForResult){
       jQ('[id="current_outstanding_balance_check"]').val('True' );


   }else{
       jQ('[id="current_outstanding_balance_check"]').val('False' );


   }

} ```

Now I have no error, but it shows me "False" even though both fields are empty.

1 Answer 1

1

You need to add the check for both values:

if(parseFloat(overduer) + parseFloat(overdue) == parseFloat(fieldNameForResult)){
Sign up to request clarification or add additional context in comments.

8 Comments

Ok, it works so that I have to enter both the same value and the point is, for example, that one overduer is 50 and the overdue is 4, not two 54 . For example ` if(overduer + overdue == fieldNameForResult ){ `
@Gajka42 so you want to check if 50 + 4 = 54? aka overduer + overdue = fieldNameForResult
Yes, if two values achieve the same result as the variable fieldNameForResult
@Gajka42 edited the answer. But this only works if all 3 variables are numeric. if not: parseFloat(overduer) for every variable
No, its no working your edited. I I can see "False" at startup even though there are both 0 values
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.