Ben Langhinrichs

Photograph of Ben Langhinrichs

IBM Champion logo

E-mail address - Ben Langhinrichs







Recent posts

Thu 6 Sep 2018

Driving a RESTful interchange #2 - JSON



Wed 29 Aug 2018

Driving a RESTful interchange



Mon 20 Aug 2018

Learning Salesforce to improve Domino and vice-versa


September, 2018
SMTWTFS
      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

Even in simplicity there is complexity

Mon 16 Sep 2013, 12:56 PM



by Ben Langhinrichs
One of the challenges of writing software is to balance the simplicity and complexity so that the users can mostly revel in the simplicity, but can harness the power of the complexity when necessary. For example, the following are all fairly simple agents, but the first uses only defaults and thus renders all the non-system items on the document, and renders the full rich text field. The second narrows down the export to specified fields. The third uses those same narrow set of fields, but renames them. It also says to only render the first graphic in the Photo field and to render the Col1 item as plain text.

%REM
   Agent SimpleAgent1.json - Generate all non-system items
%END REM
Option Public
Option Declare
Uselsx "*lsxrtc"

Sub Initialize
   Dim gColl As New GeniiCollection
   Call gColl.AddByFTSearch("""CurbAppeal.nsf""Lyndhurst")
   Print gColl.GenerateJSON("""")
   Print "Content-Type: application/json"
   Print ||
   Print gColl.GenerateJSON("""")
End Sub




%REM
   Agent SimpleAgent2.json - Only generate certain items in a particular order
%END REM
Option Public
Option Declare
Uselsx "*lsxrtc"

Sub Initialize
   Dim gColl As New GeniiCollection
   Call gColl.AddByFTSearch("""CurbAppeal.nsf""Lyndhurst")
   Print "Content-Type: application/json"
   Print ||
   Print gColl.GenerateJSON("StreetAddress,City,Price,Photo,Col1""")
End Sub




%REM
   Agent SimpleAgent3.json - Rename some variables and alter the rich text generated
%END REM
Option Public
Option Declare
Uselsx "*lsxrtc"

Sub Initialize
   Dim gColl As New GeniiCollection
   Call gColl.AddByFTSearch("""CurbAppeal.nsf""Lyndhurst")
   Print "Content-Type: application/json"
   Print ||
   Print gColl.GenerateJSON("StreetAddress=Address,City,Price=Cost,Photo[Graphic 1],Col1[Plain Text]=Plain""")
End Sub



Copyright © 2013 Genii Software Ltd.

What has been said:


1062.1. Stefano
(18/09/2013 01.37)

It is possible to define two input parameters?

Start and Limit?

Start = Number of initial record

Limit = Number of records to display

thank you very much


1062.2. Ben Langhinrichs
(09/18/2013 05:52 AM)

Stefano, you can set MaxToAdd=num1 to set the limit to num1 and SkipInitial=num2 to skip the first num2 docs. Those are used with AddByFTSearch, AddByView and AddByFormula methods. Is that what you mean?