Trying to add a second Expression to a Dataview Condition (ie. x = true && y != 0) but I can’t seem to get the correct Syntax (Ever!!). Any helpful hints?
Try: !== for “not”
x = true && y !== 0
I see this on some condition expressions.
Here’s a list of JavaScript conditional operators and when to use === versus ==:
-
==(Loose Equality)- Compares two values for equality, performing type conversion if necessary.
- Example:
5 == '5'//true(compares after converting the string ‘5’ to the number 5) - Use case: Rarely used due to unexpected behavior from type coercion.
-
===(Strict Equality)- Compares two values for equality without performing type conversion. Both the value and the type must be the same.
- Example:
5 === '5'//false(different types: number vs string) - Use case: Preferred in most cases to avoid unintended results caused by type conversion.
-
!=(Loose Inequality)- Compares two values for inequality, performing type conversion if necessary.
- Example:
5 != '5'//false(compares after converting the string ‘5’ to the number 5) - Use case: Rarely used, just like
==, due to potential confusion from type coercion.
-
!==(Strict Inequality)- Compares two values for inequality without performing type conversion.
- Example:
5 !== '5'//true(different types: number vs string) - Use case: Preferred in most cases for ensuring both value and type are considered.
When to use === vs ==:
-
Use
===(strict equality) when:- You want to avoid type conversion.
- You care about both the value and the type being the same.
- Example:
0 === ''//false(because number 0 and an empty string are not the same type).
-
Use
==(loose equality) when:- You’re okay with type conversion or want JavaScript to automatically handle it.
- Example:
0 == ''//true(because JavaScript converts the empty string to 0 before comparison).
In general, using === and !== is recommended to avoid the pitfalls of automatic type conversion.
Expression Examples
'{%GLAccountTableName%.ExtCompanyID}' !== '' && '{%GLAccountTableName%.ExtCompanyID}' != 'undefined'
'{TransView.currApplyDate}' !== '{FARevalue.ApplyDate}'
'{sysPages.pageId}' === 'ABTPostEntityPage' || '{sysPages.pageId}' === 'ABTPostCodePage'
('%currentDataView%' === 'BRFuncOperation' || '%currentDataView%' === 'BROperation' || '%currentDataView%' === 'BROperationCustom' ) ? true : false
%ACTBook.hasChanges% == true && '{ACTBook.RowMod}' != 'undefined'
{ACTBook.UseMapFlag} === true
%BRFunction.count% > 0 && ('{sysPages.pageId}' === 'FunctionPage' || '{sysPages.pageId}' === 'Slider.FunctionPhraseEdit')
Maybe it supports ge, ne, etc… I do see some helpers
Condition vs Expression
I think Epicor handles conditions differently than expressions by supporting single = and eq, ne, gt etc…
Perhaps it supports both syntax as long as OR, AND are used and not mixing javascript and epicor syntax.
TransView.SysReadOnly = true OR ([JobHead].[JobReleased] = true AND [JobHead].[FSMSendTo] = true)
I think it may also support ne, ge, gt and helpers like isEmpty, isUndefined etc… just havent seen any examples.
You want to use AND.
x = true AND y != 0
What the heck is that gibberish?
That explains it, it does support the shorthand versions as long as you use AND, OR etc… makes sense.
| Operator | Description | Example |
|---|---|---|
AND |
Combines two or more conditions where all conditions must be true. | (Approved AND Verified) |
OR |
Combines two or more conditions where at least one condition must be true. | (Approved OR Rejected) |
NOT |
Negates a condition, making true conditions false and vice versa. |
NOT Approved |
IN |
Checks if a value is present within a list of values. | (ID IN (10, 20, 30)) |
IS |
Compares a value to NULL or other specific values, often used with NOT. |
(Status IS NULL) |
IS NOT |
Checks if a value is not NULL or another value. |
(Status IS NOT NULL) |
| Operation | Description |
|---|---|
eq |
Compares two values for equality (===). If the values are dates, it compares their time values using getTime(). |
neq |
Compares two values for inequality (!==). If the values are dates, it compares their time values using getTime(). |
gt |
Checks if the first value is greater than the second. For dates, compares using getTime(). |
ge |
Checks if the first value is greater than or equal to the second. |
lt |
Checks if the first value is less than the second. |
le |
Checks if the first value is less than or equal to the second. |
contains |
Checks if the first value contains the second value as a substring. |
starts |
Checks if the first value starts with the second value. |
ends |
Checks if the first value ends with the second value. |
isNull |
Checks if the value is null. |
isUndefined |
Checks if the value is undefined. |
isEmpty |
Checks if the value is an empty string (""). |
isTrue |
Checks if the value is strictly equal to true. |
isFalse |
Checks if the value is strictly equal to false. |
in |
Checks if the first value exists within the second value (which could be an array or a list). Uses the operationIn function for handling this check. |
Thanks
So I was able to get this to sort of work with
x = true AND y > 0
since, in this instance, the value will never be less than zero but nothing would work for “not equal to”.
!== did not work?
