193 Lotus blogs updated hourly. Who will post next? Home | Blogs | Search | About 
 
Latest 7 Posts
Great news about BM Notes/Domino 9.0.1 Feature Pack 8
Fri, Jan 27th 2017 6
How to set Workspace as default homepage in IBM Notes client
Wed, Oct 26th 2016 6
Avoid processing items as both NotesItem and NotesMIMEEntity objects concurrently.
Thu, Jul 21st 2016 5
Third level in "Application links" section of Xpages Application Layout, WTF?
Sat, Jul 16th 2016 7
How to get a list of components for not open Xpage ?
Thu, Mar 24th 2016 6
LDAP on Domino with iPhone (iOS8x) - can it work?
Mon, Sep 14th 2015 6
A question: do you know how to disable/remove/cleanup Xpages tooltips in Domino Designer? They make me crazy.
Fri, Sep 11th 2015 6
Top 10
How to find out if PIRC is enabled programmatically
Sat, Nov 22nd 2014 12
How to implement "Totals" with Data View control
Fri, Sep 11th 2015 12
NotesItem.Type = 256 causes "Variant does not contain a container"
Sat, Jul 26th 2014 11
NotesAgent.Runwithdocumentcontext() - cool thing
Thu, May 29th 2014 11
No such session or session has been closed
Sun, Nov 2nd 2014 9
Corrupted unread list in Mail database caused "This database cannot be read due to an invalid on disk structure"
Thu, Jul 17th 2014 9
FTSearch "show results" field - cool thing
Sat, Jul 26th 2014 8
IBM Lotus Notes and Ctrl+Break on new laptops without button "Pause/Break" on keyboard. Is it familiar to you? :-)
Thu, May 29th 2014 8
Third level in "Application links" section of Xpages Application Layout, WTF?
Sat, Jul 16th 2016 7
How to focus Lotus Notes window (standard version)
Wed, Dec 17th 2014 6


How to implement "Totals" with Data View control
Twitter Google+ Facebook LinkedIn Addthis Email Gmail Flipboard Reddit Tumblr WhatsApp StumbleUpon Yammer Evernote Delicious
   

Hi

Earlier I posted a question about how to implement totals with Data View control.
Thank's everyone for help.
Eventually I managed to do it and now I see that it was a shame to ask for help :-), too easy....

So, let me show you how I did it

1) Let's imagine we have a "Test" form with three fields "a", "b" and "c".

2) Then we create a simple Notes View with three categorized columns, which categorized columns for "a", "b" and "c" correspondingly. Important condition: each nested category column should contain a value of a parent category via some specific separator. I chose "###" as a separator.
You can use also this trick to make it working faster.
So, eventually we get something like this:
(just for clarification: the first document in the view has fields [a]="aaa", [b]="bbb" and [c]="ccc")

The first column with totals serves just for making the demo easier - I do not use it with Xpages so you may not create it.


3) Now let's create XPage with Data View, define data source and define three categorized columns there. Here is a code of categorized column "value" property:

getCategoryValueAndCount(this, viewEntry, 3)

Parameters description:
this - data source
viewEntry - variable name of a data row 
3 - column 's position in the Notes view


4) Here is SSJS function that does my magic:

function getCategoryValueAndCount(dataView, viewEntry, colIndex) {
try {

var vc:com.ibm.xsp.extlib.component.data.UIDataView = dataView;
var vcds:com.ibm.xsp.model.domino.DominoViewData = vc.getData();
var viewName =  vcds.getViewName();
var ve:NotesViewEntry = viewEntry;
var veColumns = ve.getColumnValues();
var categoryValue = veColumns.elementAt(colIndex);
var categoryValueToDisplay = @RightBack("###" + categoryValue, "###");
var db:NotesDatabase = null;
if (vcds.getDatabaseName()) {
db = session.getDatabase(@Left(vcds.getDatabaseName(), "!!"), @Right(vcds.getDatabaseName(), "!!"))
}
else {
db = database;
}
var view:NotesView = db.getView(viewName);
var allCategories = categoryValue.split("###");
var allCategoriesKey = "";
for (i = 0; i < allCategories.length; i++) {
if (i == 0) {
allCategoriesKey = allCategories[i];
} else {
allCategoriesKey = allCategoriesKey + "\" + @Subset(allCategories, i + 1).join("###");
}
}
var nav:NotesViewNavigator = view.createViewNavFromCategory(allCategoriesKey);
var counter = 0;
var nve = nav.getFirst();
while (nve) {
if (nve.isDocument()) {
counter = counter + 1;
}
nve = nav.getNext(nve);
}

return categoryValueToDisplay + " (" + counter.toString() + ")" 

} catch(e) { 
             //error handler
}
}

Here is what I see after all.


The nice thing about such solution is that the totals are real, they take into account READERS fields, so the user sees a number of documents which he/she really has access to.

--------------------------------------------------------

Some good guy suggested me to try CategoryRow facet from DataView control to implement the totals. Unfortunately it didn't work for me: facet keys "categoryRow1", "categoryRow2" and so on didn't work for me, only "categoryRow" worked - however I could do something wrong so may be it is still an alternative option. Thank you everyone for help anyways.

---------------------
http://ypastov.blogspot.com/2015/09/how-to-implement-total-columns-with.html
Sep 11, 2015
13 hits



Recent Blog Posts
6
Great news about BM Notes/Domino 9.0.1 Feature Pack 8
Fri, Jan 27th 2017 3:22p   Yuriy Pastovenskyy
Notes/Domino Fix List (Copied from here) IBM Notes/Domino 9.0.1 Feature Pack 8 Preliminary Release Notice January 27, 2017 Beginning with 9.0.1 FP8, fix packs have been renamed to feature packs. To ensure quality, these feature packs still have a high focus on addressing high impacting defects. Where possible, these features are optional enabled to minimize risk. The same packaging, architecture and install kits used in previous fix packs remain in use for feature packs. IBM has identified im
6
How to set Workspace as default homepage in IBM Notes client
Wed, Oct 26th 2016 11:22a   Yuriy Pastovenskyy
Hi Recently I've got the task to set up Workspace as default homepage in IBM Notes client for about 400 users. Googling didn't really help - suggestion from IBM I found looked crazy and I didn't want to mess with it. My hope on Domino policies didn't work either - not sure, may be I missed something. However I found another interesting thing that can be very helpful for resolving this task. Database Bookmark.nsf (where Workspace is actually located) contains form "WPDiscoverChange" wi
5
Avoid processing items as both NotesItem and NotesMIMEEntity objects concurrently.
Thu, Jul 21st 2016 4:46a   Yuriy Pastovenskyy
Hi guys May be this will save a day to someone. Let's imagine you need to send email with HTML inside. In most of cases you would need to use NotesMIMEEntity class and probably some other MIME-related classes to build mail Body. Though it is possible to use the same classes to define Subject, SendTo, CopyTo and other mail headers people often use usual NotesItem-based syntax for the rest simple mail parameters. However very important point is that as soon as you used NotesMIME-class you can
7
Third level in "Application links" section of Xpages Application Layout, WTF?
Sat, Jul 16th 2016 12:51p   Yuriy Pastovenskyy
Hi Do you know how to create a third level in "Application links" section of Xpages "Application Layout" control? It has to work but it doesn't. Please look on my screen shots below. Here is a simple page with a single "Application layout" control (Bootstrap theme). I have added three levels for my top menu (in different ways). However in browser I only can see two first levels and whatever I tried to do the third level never appear. Do you know how to fix that? P.S.I have the lates




Created and Maintained by Yancy Lent - About - Planet Lotus Blog - Advertising - Mobile Edition