Stream Processing (Part 2) The second half of our Stream introduction. If you haven’t read the first half, I recommend you do so before going forward. In this post, we cover: reduce flatMap and nested queries Using chunk to improve nested query performance Creating custom Streams reduce Conceptually, a Stream can be viewed as a collection containing the results of a query. However, sometimes we want to boil down (or reduce) this collection of records into a single value.
Stream Processing (Part 1) In this series, I’ve mentioned the Stream class, which is the way GlideQuery users process multiple records and groups returned by the select method. Stream is similar to Java’s Stream class and C#’s IEnumerable interface. In all the examples so far, I’ve only used Stream’s forEach method, as that’s one of the most common Stream methods available. There are, however, other powerful Stream methods available that can enhance your code.
Dotwalking and Flags Similar to GlideRecord, GlideQuery supports dotwalking, both when using select and where. It dramatically simplifies filtering and reading in fields referenced by the current table instead of executing another GlideQuery. Dotwalking is presumed in the Now platform and should be reasonably familiar to most GlideRecord developers. Dotwalking Just like GlideRecord, GlideQuery supports filtering using dotwalking: var tokyoEmployee = new GlideQuery(‘sys_user’) .where(‘company.city’, ‘Tokyo’) .selectOne(‘name’) .get(); When dotwalking, GlideQuery performs the same set of validation checks as regular field names.