Here's a Saved Search doosy. I want to search aga...
# suitescript
d
Here's a Saved Search doosy. I want to search against the
Schedule Script Instance
record. This particular Scheduled Script has several deployment. I want to return the latest result for each deployment. I want to grab the startDate, status and percent complete.
👍 1
Currently, I group by deployment and get teh MAX for StartDate, Status and Percent Complete.
The summary types are lining up nicely though
e
Is there a question?
I can't tell if you're asking how to do this or if you've got it figured out
d
Sorry @erictgrubaugh, I'll explain
e
Sounds like a WHEN ORDERED BY use case
At least based on the "return the latest result" portion
d
that sounds greek to me
e
Are you building this search in code?
In the UI, it looks like this. Just set up whatever Criteria you'd like, then use the WHEN ORDERED BY field on your Results like so.
In code, the
Column
object has a
setWhenOrderedBy
method
This is the example I have in my Transaction Search cookbook
Note there is a "bug" in
setWhenOrderedBy
where you must provide a join, even if you're not ordering on a joined field, so you just specify a nonsense join
d
Wow @erictgrubaugh, thanks for this! Hope you and the fam are well and safe!
I need to learn me some
WHEN ORDERED BY
✔️ 1
🎓 1
@erictgrubaugh, quick follow up on this one ... do I need to
setWhenOrderedBy
on each MAX value column I want?
e
I think so
d
Here's where I'm at ...
e
That seems right; at least that's how I'd build it in the UI. I haven't used WOB on multiple columns in a scripted search though
d
Cool. Thanks. I'll keep you posted (this was a sanity check). Cheers! Hope you and the family are safe and well!
e
Same to you; your columns look right to me