Genii Weblog
Even in simplicity there is complexity
Mon 16 Sep 2013, 12:56 PM
Tweetby 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:
1035.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
1035.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?