I could have sword returning a `query.runSuiteQL` ...
# suitescript
r
I could have sword returning a
query.runSuiteQL
in a map/reduce script would allow for larger data loads than 5,000 results. Doesn’t seem to be working how i thought, as the map method doesn’t have results. Suggestions? What am I missing?
⚔️ 1
e
runSuiteQL()
returns a
ResultSet
.
getInputData
wants you to return either a
Query
object (like that created by
query.create()
) or an object of the format
Copy code
{
    type: 'suiteql',
    query: 'SELECT id, email FROM Employee WHERE currency = ?',
    params: [currency]
}
a
The method
query.runSuiteQL
has a limit of 5000 results, you can use
query.runSuiteQLPaged(options)
to handle that. Please notice that if the NetSuite instance do not have
SuiteAnalytics Connect
enabled you will be limited to 100k results.
e
All of this is true, but the limits of searches and queries don't apply when you return them from
getInputData
in a specific way, which I assumed was the OP's intent here.
a
@Ryan Valizan I'm not familiar with returning raw objects (searches or queries) from the
getInputData
because I don't like or use that. But I do trust @erictgrubaugh 100%, so you can try what he is saying.
thisline 1
e
I've not actually used the query version, but I have used the search version many times.
r
@erictgrubaugh I converted it to a query.create object. is it normal for the map stage to get columns and values as separate arrays?
e
While I'm not completely sure about how they behave specifically in a Map/Reduce, this is normal when you run either a search or a query, yes. You get both so that you can dynamically understand the shape of the result object, if you need
Unfortunately when you let the Map/Reduce handle the deserialization of the results - rather than doing it yourself in
getInputData
- the process is opaque, so I don't know exactly how NetSuite does it internally