Dear Experts, I'm trying to add condition to my ex...
# suitescript
u
Dear Experts, I'm trying to add condition to my existing workbook using suitescript N/query module but getting operator error.
Copy code
if (date) {
        var addCondition = nsQuery.createCondition({
                fieldId: "lastmodifieddate",
                operator: query.Operator.ANY_OF,
                value: date         //date = ['3/1/2021']
        });

        nsQuery.condition = addCondition;
}
{     "error": {         "code": "OPERATOR_ARITY_MISMATCH",         "message": "Operator ANY_OF doesn't work with specified number of arguments"     } }
b
go in the ui and create the condition you wish to make
use the same operator that the ui uses
different operators support different data types and require different values
u
can you tell me how this can be done using suitescript. because I tried every single possibility but still getting operator error UI attached
b
have you made the dataset in the ui
u
yes
b
load it via code and inspect its condition
u
Still getting same error
b
what does your code look like now
u
inspect condition and current code
b
value vs values
u
checked for both values and value
b
and the dateId changed to have a value of "TODAY"?
relative dates have specific objects that are distinct from other conditions
u
works fine thanks. How do I set the value using object?
b
probably what you had before, with "TODAY" as the date
potentially with null as an additional value since WITHIN probably requires 2 values for a range