So I'm a bit confused right now, left it the resul...
# suiteql
b
So I'm a bit confused right now, left it the result from using the suiteql editor from @Matt Bernstein and right is the suiteql editor from @tdietrich The right one shows no results and so does NetSuite when I'm using the exact query in SuiteScript. What's going on?
I also tried the query in NimbusQL and it also did not return anything
So what I see is that when I remove the following condition it
AND tx.status = 'A'
it works in @tdietrich's editor, NimbusQL and NetSuite. But I need that filter on the status.
m
that’s interesting, mine is giving different results. all it’s doing is wrapping the sql in the editor and returning the results. The query is run on the server via a suitelet request vs running on the client. (even the query promise froze the page originally). Is it possible the suitelet is not set to execute as current role?
Copy code
const query = ({ sql, limit, pageSize }) => {
    if ( !sql ) return [];

    const sqlPageSize = pageSize || 5000;
    let paginatedRowBegin = 1;
    const paginatedRowEnd = limit || 9999999999;
    const records = [];
    let isMoreRecords = true;
    do {
        const paginatedSQL = `SELECT * FROM (SELECT ROWNUM AS ROWNUMBER, * FROM (  ${sql} ) )  WHERE ( ROWNUMBER BETWEEN ${paginatedRowBegin} AND ${paginatedRowEnd} )`;
        const queryResults = query.runSuiteQL({ query: paginatedSQL, params: [] }).asMappedResults();
        records.push( ...queryResults );
        if ( queryResults.length < sqlPageSize ) {
            isMoreRecords = false;
        }
        paginatedRowBegin += sqlPageSize;
    } while ( isMoreRecords );

    return records;
};
could you also send the raw query, so I don’t have to type it all out?
👍 1
b
For now I have just used != 'B' which works for all, NetSuite included :S
@Matt Bernstein I have sent it to you via a DM.
a
I've somewhat given up on filtering on that status code as it is very inconsistent. What I've done instead is filter on BUILTIN.DF(t.status) = 'Work Order: Planned' (or whatever your status is) and that seems to work consistently