Is it T? F? true? false? welcome to NetSuite's Shr...
# random
c
Is it T? F? true? false? welcome to NetSuite's Shrodinger Checkboxes
s
the joke is this is under a function called validate_itsWorking()
a
What really bothers me is that it defaults to
null
s
are you sure it's null not undefined? :x
a
I'm referring to suiteql. Not sure about suitescript.
👍 1
s
the inconsistency that hits me is especially hard if you work 1.0 and 2.x its like exquisuitely different
@Alan Fitch keep workng on the queries module, honestly your externalid solution was really really good ha
a
Remind me which one was that?
s
Copy code
record.load({id:query.runSuiteQL(`SELECT id from mycustomrecordtype where externalid = ${myexternalid}`).asMappedResults()[0].id, type: mycustomrecordtype})
something like this??
worth a weeks worth of coffee imo 😂
a
Ah sounds like something I would suggest.
🙌 1
Honestly haven't used record.load in a while.
query.runSuiteQL("SELECT * FROM transaction where id = ${id}").asMappedResults()[0]
is my go to unless writing data.
c
I really gotta start using suiteql. Seems super powerful
It needs a webstorm plugin IMO so I don't have to leave my IDE to write queries
a
@creece you're missing out on the good stuff.
c
Thats what I am realizing
a
Netsuite's api's are the clunkiest I have ever seen.
s
@creece I use saved search 90% becayse of @michoel’s chrome plugins, but I also agree using suiteql is like using a new tool/weapon
j
I basically SuiteQL everything these days.
way faster for me
s
i see the query module following the suiteanalytics workbook meaning potentailly you can drill more than one layer, that's god
j
be aware that it only returns 5000 results though. I wrote a wrapper to get all results.
a
Just the asMappedResults() method which allows you to use the result as an array of objects makes it far superior then saved searches.
@jen i stole it from @tdietrich haha.
j
multijoins, nested searches, etc FTW
a
Here's a cool query I wrote recently. Calculate the potential GL impact of a work order close before you close it. You need to join the routing items, cost categories, work order completions etc. Impossible to write in a saved search and probably hundreds and hundreds of lines of suitescript.
s
@jen and @Alan Fitch can I ask you if theres a methodology in which you use N/query? Or is this your prime way of using?? Like with N/query do you still use search.lookupFields or search.create/load.run().each/,getRange()
a
The only method I use is query.runSuiteQL.
And the only way I access results is asMappedResults.
j
I pretty much just write the entire thing in one SQL if possible.
some of my sql is….large
working on one SQL right now that’s 700 lines long.
a
Do you use CTEs?
j
nope
no experience with those
a
It has shortened my queries greatly. CTEs
j
if I have a chunk of the SQL that’s reused, I just put that in its own JS variable and then use it where needed.
a
Ah I used to do that. What CTEs add is that you can have successive CTEs that each use the previous ones.
j
ahh
cool, I will keep that in mind as it could come in very handy
I miss stored procedures 😞
n
@Alan Fitch @jen are you good with SQL? The only reason I am avoiding SuiteQL is because my SQL is not good.
a
You need only the most basic sql for suiteql.
s
I shudder to think large SQL programs being written (and maintained) for SuiteQL. Tooling for writing them is rudimentary and nonexistent for debugging/maintaining. I use SuiteQL a lot, but most of my queries are short and effective and easy for the next developer to understand.
a
SuiteQL is new. The tooling will come.
s
the ironic thing is how old SQL is 🙂
a
You can use SuiteTalk to query SuiteQL so all someone needs to do is write an ODBC driver is mostly solved. I'm doing a bit of research now but it does look really complicated.
s
I kinda wish someone had a GraphQL adapter for NS