domino-jna icon indicating copy to clipboard operation
domino-jna copied to clipboard

Subforms

Open sattam-datum opened this issue 4 years ago • 5 comments

Is there a way to get subforms related to a specific form?

In standard notes. jar I can get any subform by name using Database.getForm but I didn't find any linkage between form and related subforms

sattam-datum avatar Jan 07 '21 11:01 sattam-datum

I just added NotesDatabase.getForms(): 37778797bfee9facb6a6785d317711ed7b805b81 20e62309817e4723b86dfd9d2ee39caa8bb0cf12

Next I will take a look at subform usage. Should be possible by traversing the design richtext ($body item).

klehmann avatar Jan 08 '21 17:01 klehmann

And here are the methods to read subform names and formulas: 80cc4d4e7f94b7612c482cc9ecf9c26440311096

klehmann avatar Jan 11 '21 15:01 klehmann

thanks, Can you add sample code of how to use it? And when will you release latest artifact?

sattam-datum avatar Jan 12 '21 06:01 sattam-datum

I think you can always have a look at the test-code to see how to use the new methods: https://github.com/klehmann/domino-jna/blob/master/domino-jna/src/test/java/com/mindoo/domino/jna/test/TestDesignFormAccess.java

frocentus avatar Feb 19 '21 13:02 frocentus

Here is a snippet:

NotesDatabase db = new NotesDatabase("", "mydatabase.nsf", "");
NotesForm form = db.getForm("MyFormWithSubform");
				
//read the design richtext
IRichTextNavigator rtNav = form.getNote().getRichtextNavigator("$Body");
				
//returns pairs of dbreplicaid/subformname that are contained in the form
//(replica id "0000000000000000" for the same db as the form)
List<Pair<String,String>> namedSubforms = RichTextUtils.collectNamedSubforms(rtNav);
				
//returns a list of subform formulas
List<String> subformFormulas = RichTextUtils.collectSubformFormulas(rtNav));

klehmann avatar Feb 19 '21 14:02 klehmann