Search code examples
sqlnetsuitesuitescript

Netsuite: I cant figure out why my query.load receiving this error


So I am trying to load a workbook query and then ultimately do q.toSuiteQL() . Generally works fine. For some reason on this new workbook I'm getting an error on the query.load:

{ 
    "type":"error.SuiteScriptError",
    "name":"OPERATOR_ARITY_MISMATCH",
    "message":"Operator ON_OR_BEFORE doesn't work with specified number of arguments",
    "stack":[XXX],
    "cause":{
        "name":"OPERATOR_ARITY_MISMATCH",
        "message":"Operator ON_OR_BEFORE doesn't work with specified number of arguments"
    },
    "id":"",
    "notifyOff":false,
    "userFacing":true
}

Not sure what is wrong because the same exact code works for me for other workbooks and the workbook itself looks fine, loads the data in the GUI.


Solution

  • value Mapped string value Used for
    ON_OR_BEFORE ON_OR_BEFORE works with Date/time values

    Values for this enum are listed in the Values section. The above table provide information about the operator you have used:

    Value — Use these values to specify operators in most queries (for example, query.Operator.BEFORE). To use these values, you must include the N/query module in your script.

    Mapped String Value — Use these values as strings that represent the corresponding operators (for example, 'BEFORE'). To use these values, you do not need to include the N/query module in your script.

    Use For — Use this column to determine the value types that each operator supports. For example, the query.Operator.AFTER operator is designed to be used with date/time values, and you cannot use this operator with string or boolean values. Some operators are similar but are designed to be used with different value types (such as query.Operator.IS for boolean values and query.Operator.EQUAL for numeric values).

    For multi-select fields, you can use the query.Operator.INCLUDE_* and query.Operator.EXCLUDE_* values to specify a set of exact field values. For example, to obtain script deployment records that apply to all execution contexts except the WEBAPP and WEBSTORE contexts, you can use the query.Operator.EXCLUDE_ALL operator. You cannot use the query.Operator.ANY_OF_NOT operator to obtain these records, because this operator uses an implicit OR operator between all specified values. The query.Operator.EXCLUDE_ALL operator uses an implicit AND operator between all specified values, which lets you create more complex conditions

    Please share the code, looks like there is be a mismatch between the operator used and the argument.