If condition not working with comparison operators
Hi,
I have got a headache trying to understand why can Ninox scripting engine comprehend such a simple If condition together with "and" and "or" operators:
Requirement:
To display the number of days by which the invoice is overdue in case the overdueDays > 0 and currentInvoiceStatus is not Cleared or Cancelled.
Different Invoice Status:
1 - New, 2 - Sent, 3 - Cleared, 4 - Overdue and 5 - Cancelled
Result:
With the current code above, I am getting the overdue days in all the conditions no matter what (whether the currentInvoiceStatus is "New" or "Cancelled" or "Cleared" or "Paid" or "Overdue").
It should only show the overdue days if the currentInvoiceStatus is either "New" or "Sent". If the currentInvoiceStatus is "Cleared" or "Cancelled", the overdue days should be null.
Thanks,
Vermaji
--------------------------
18 replies
-
This example can be referred to..
-
Well I got this to work for me:
I would've thought the 'or' would be the most appropriate way to write the code. I still get tripped up with this when I write my code. I guess the best way to remember is to think of it as a list of requirements so it is always an 'and'.
I want this to be true if:
variable doesn't equal 3
and
variable doesn't equal 5
and
-
I would second opinion to use a switch as it will make things easier to read and troubleshoot.
-
said:
Is it possible to hide the Table view when we open a database and go straight to the SwitchboardLook in the Options for the DB.
Content aside
- Status Answered
- 6 mths agoMon, July 8, 2024 at 1:21 PM UTCLast active
- 18Replies
- 68Views
-
4
Following