Ben Langhinrichs

Photograph of Ben Langhinrichs

E-mail address - Ben Langhinrichs

Recent posts

Tue 19 Jan 2021

Fancy tricks with REST API - Part 1

Mon 11 Jan 2021

REST plus RPC: building the JavaScript for RPC calls

Wed 6 Jan 2021

REST plus RPC: the right data in the right format, and no more

January, 2021
     01 02
03 04 05 06 07 08 09
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

Search the weblog

Genii Weblog

Short agents

Wed 14 Nov 2018, 09:41 PM

by Ben Langhinrichs
When I say I still write LotusScript, I should include a disclaimer that my scripts tend to be under 30 lines long. Here's one that generates JSON for the documents in a specific view using MongoDB format and spits it out to the browser. All of nineteen lines long if you count the Dims and such. Before somebody says it, I know you can generate JSON with a special Domino URL, but you'd have zero control over the output, whereas I can change that one parameter to 'Saleforce' and get  a different set of JSON or to 'Domino' and get yet another. Or I can pick just a few items to include. Or include formulas or db lookups. Or change that to a GenerateCSV call and get a CSV stream. On top of that, any rich text which gets converted is high fidelity and intact, unlike the stuff generated by the Domino server natively. But otherwise, I'll acknowledge that it's pretty much the same thing as Domino Access Services if you'll acknowledge that the New England Patriots are playing pretty much the same game as the Cleveland Browns.

Anyway, short agents don't have to be short on functionality if you have Tom Brady the Midas LSX on your team.

(My apologies if you are not a U.S. sports fan and don't understand the analogy. I'm sure some of the Boston-based IBMers and HCLers could interpret for you.)

Inline JPEG image

Copyright 2018 Genii Software Ltd.

What has been said:

1100.1. Doug Finner
(11/14/2018 12:25 PM)


I can't thank you enough for your willingness to give back to the community. I've used your help for much of the time I've been doing Notes and appreciate your expertise and good humor. Thank you!

1100.2. Erik Brooks
(11/15/2018 11:53 AM)

Nice, Ben. Though for this to perform well on larger datasets you should use a stringbuffer. This line:

totalstr = totalstr + textstr

...gets brutal fast.

1100.3. Ben Langhinrichs
(11/15/2018 02:35 PM)


Of course, you are right. This is just a demo. In a real application, I could change the

totalstr = totalstr + textstr


Print textstr

or process some other ways. This is good for demos because I can look at the whole JSON string at once. But I should think about making my short agents more production-ready.