359 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Pods | Blogs | Search | myPL | About 
 
Latest 7 Posts
Design changes during SmartCloud Notes migration
Mon, Feb 24th 2014 148
Processing multiple users in the SmartCloud Notes administration UI
Fri, Feb 14th 2014 214
The property role is deprecated and no longer supported.
Fri, Nov 1st 2013 163
OpenSocial and Domino - seeking feedback
Tue, Oct 29th 2013 153
I’m on TV for several seconds...
Mon, Jun 24th 2013 142
Followup on getting long-standing bugs fixed
Wed, Jun 19th 2013 108
XPages best practice: computed selection lists
Fri, May 24th 2013 140
Top 10
Better SSJS validation for XPages
Wed, Jan 5th 2011 215
Processing multiple users in the SmartCloud Notes administration UI
Fri, Feb 14th 2014 214
The property role is deprecated and no longer supported.
Fri, Nov 1st 2013 163
Searching for blank date fields, and what makes a supported feature
Mon, Oct 31st 2011 160
OpenSocial and Domino - seeking feedback
Tue, Oct 29th 2013 153
Design changes during SmartCloud Notes migration
Mon, Feb 24th 2014 148
I’m on TV for several seconds...
Mon, Jun 24th 2013 142
Beware <script> in XPages
Wed, May 15th 2013 141
XPages best practice: computed selection lists
Fri, May 24th 2013 140
Delete empty folders, take 2
Wed, Apr 10th 2013 132


Another way to make an efficient date/based view
Andre Guirard    

This technique isn't applicable in all situations, but it's a way to make a date or time-based view whose index is only rebuilt when needed, and doesn't require that the date be hardcoded into a design element. The example is intended for use in the Notes mail file, where there's only one user who we're mainly concerned about. It could be used in a shared app context, but in that case it should be set up to use the server's time settings, not the client's as in this example, since different users would be plugging in different formulas and causing constant rebuilds based on their client's settings as opposed to someone else's.
The problem is how to get the view index to be rebuilt only when it is needed, and without "flashing" (i.e. we don't want to open the view and then notice it's out of date). I've been testing this solution and it seems to work.


In the folder, you define a UDC (user-definable column) whose item name is, say "$ZoneDay":

Image:Another way to make an efficient date/based viewImage:Another way to make an efficient date/based view
We use the profile name ColorProfile because the Inbox already contains another UDC with the same profile, and any given view can only use one profile doc for UDCs.


Now, you have to set up the profile document to contain the correct formula for the date-based value you'd like it to display. For this we can use the view's queryopen event, for instance:

Sub Queryopen(Source As Notesuiview, Continue As Variant)
       Dim db As NotesDatabase, sess As New notessession

       Set db = sess.CurrentDatabase

       Dim docPro As NotesDocument, curFormula$, newFormula$, midnight$, gmtMid

       Dim tmpTime As New NotesDateTime("")

       tmpTime.lslocaltime = Today ' which translates to today at midnight.

       gmtMid = tmpTime.LSGMTTime

       midnight = {@ToTime(@Text(@Date(} & Year(gmtMid) & {; } & Month(gmtMid) & {; } & Day(gmtMid) & {; } & Hour(gmtMid) & {; } & Minute(gmtMid) & {; 0)) + " GMT")}

       
       Set docPro = db.GetProfileDocument("colorprofile")

       curFormula = Replace(docPro.GetItemValue("$ZoneDay")(0), Chr$(13), "")

       newFormula = {todayMid := } & midnight & {;

daysOld := (todayMid-PostedDate) / 86400;

@If(daysOld <= 0; "today"; daysOld <= 1; "yesterday"; "older " + @Text(@Integer(daysOld)))}

       If curFormula <> newFormula Then

               docPro.ReplaceItemValue "$ZoneDay", newFormula

               docPro.Save True, False, True

       End If

End Sub


Some comments about this approach:
  • On the line beginning "midnight =", we represent the date by using the @Date function with six arguments. This is done rather than just hardcoding the time constant [mm/dd/yyyy hh:mm:ss GMT] for instance, because we have no way to know the server's date formatting settings. The formula has to be comprehensible by the server, but this code executes on the client, so we can't just format the date as the client would by default.
  • If performance ends up being a problem and you want to find a way to format the date so the server understands it, you might:
    • try using the @TimeMerge function.
    • see whether the format [yyyy/mm/dd hh:mm:ss am/pm] is interpreted the same by all servers (note, however, that "/" might not be universally used as a date delimiter).
    • I'm trying to get a way of representing date/times that's static across all platforms and settings, e.g. as a hex code. I need it for DXL, but as we can see here there are other applications for it.
  • When it's asked to open the view, the view indexer is smart enough to know that if the profile document (colorprofile in this case) has been modified since the view was last opened, that means that a column formula might evaluate differently for existing documents. So it knows in that case to rebuild the view index rather than refreshing. So don't save changes to the profile doc unless you mean it.
  • This approach is doesn't require Designer access for the end user, only enough authority to edit a shared profile document, which they need anyway to edit their own mail preferences. In other applications where users might not have enough muscle to do this, you might need to make the profile document contain an explicit Authors field to allow this access. It could get tricky, which is why I say this might not be applicable for all apps.
  • If you wanted to use the server's timezone settings to determine the day divisions, instead of the client's settings, you can get rid of the timezone stuff and just use the @Date function (you still can't hardcode the date in [brackets] without knowing how the server formats dates).
  • There's an extra argument to @Now to return the server's current time, and you can use that to determine what the server thinks the date is. This is not 100% obvious how to do; I think you'll have to use @Text in your Evaluate call with certain arguments, to get the time in the server's zone.


---------------------
http://www-10.lotus.com/ldd/bpmpblog.nsf/dx/another-way-to-make-an-efficient-datebased-view
May 23, 2011
85 hits



Recent Blog Posts
148


Design changes during SmartCloud Notes migration
Mon, Feb 24th 2014 11:00a   Andre Guirard
We've been having a problem with one customer who was migrating their on-premises mail users into SmartCloud Notes, because they ade a mail template change in their on-premises environment after giving us "staging" replicas of some users' mail files. The DESIGN task on the users' on-premises servers updated their mail file designs from the template, and this change replicated to users' local replicas (MMRs in this case). When the users replicated their local mail files with the service, th [read] Keywords: ldd lotus notes server
214


Processing multiple users in the SmartCloud Notes administration UI
Fri, Feb 14th 2014 9:00a   Andre Guirard
I thought I should note this change, since there's nothing in the "liveAdmin" UI (as yet) to indicate how it works. That will have to wait until we can translate the explanatory text into all our supported languages. But you can use the new functionality now. If you have a set of SmartCloud Notes users that you want to -- let's say -- assign a new mail file design using the web-based administration UI, you used to have to search for the user, select them from the search results, click the bu [read] Keywords: administration ldd lotus notes
163


The property role is deprecated and no longer supported.
Fri, Nov 1st 2013 7:13a   Andre Guirard
I recently started using the Domino Designer 9.0.1 client, and immediately noticed this slightly alarming warning in my XPages applications. The product help page "What's new in IBM Domino Designer 9.0.1 Social Edition?" lists several XML elements for which a "role" property is deprecated (search for "Obsoleting of the role property") but it was unclear whether it would still work anyway and how any difference in the build version versus the execution version was a factor. Role is used to [read] Keywords: domino ibm ldd lotus xpages application applications server xml
153


OpenSocial and Domino - seeking feedback
Tue, Oct 29th 2013 12:50p   Andre Guirard
If you've been doing development work that involves OpenSocial and Domino, I'm interested in quizzing you a little. Please reply privately using my email, which is my first and last name, with underscore, @us.ibm.com. Thanks. [read] Keywords: domino ibm ldd lotus development email
142


I’m on TV for several seconds...
Mon, Jun 24th 2013 10:00a   Andre Guirard
At about 1:10 in this news clip: http://minnesota.cbslocal.com/2013/06/23/at-the-fix-it-clinic-learn-to-fix-your-electronics-appliances/ Fixin' stuff. As I do. [read] Keywords: ldd lotus
108


Followup on getting long-standing bugs fixed
Wed, Jun 19th 2013 3:53p   Andre Guirard
A little while ago I wrote about our process for prioritizing bugs for fixing. Mathieu Pape has a related idea recently posted on IdeaJam, that you might consider supporting if you're interested in this issue. It seems like a good notion to me. [read] Keywords: ldd lotus ideajam ideajam.net




140


XPages best practice: computed selection lists
Fri, May 24th 2013 12:50p   Andre Guirard
The low-down: XPages lets you write code to calculate the values for selection lists. The value your code returns may either be an array of strings, using the pipe symbol ("|") as a delimiter between display value and stored value, or it may be an array of javax.faces.model.SelectItem objects, which each contain a display and stored value as separate data items. It's your choice. The latter method, however, is more bulletproof since you don't have to worry about pipe symbols in your data. [read] Keywords: domino ldd lotus xpages application best practice development javascript properties
141


Beware <script> in XPages
Wed, May 15th 2013 12:30p   Andre Guirard
I may be stating the obvious, but I wasn't the only one on my team caught out by this, so I thought I'd best mention it. I recently discovered the hard way that there's a problem with using elements in XPages. Always use instead. Why, you ask? Either seems to work fine! The problem comes up if your application is translated. The code that decides what parts of your page are translatable doesn't know anything about the element, so your JavaScript code is marked as a localizable string. It [read] Keywords: ldd lotus xpages application best practice javascript
116


Working the system to get bugs fixed
Mon, May 13th 2013 9:20a   Andre Guirard
An issue recently came to my attention that (based on my informal poll) has been a thorn in the side for Domino administrators for quite a while. I've been trying to figure out how it is that it's never been fixed. I'm referring to the fact that end users, when they create or rename a folder, are allowed to use various characters that have special meanings in design element names -- backslash, vertical bar, underscore, forward slash (which causes problems in mobile) and enclosing the name in [read] Keywords: domino ibm ldd lotus notes notes client notesdomino bug development ideajam mobile
132


Delete empty folders, take 2
Wed, Apr 10th 2013 9:50a   Andre Guirard
I while back I wrote a post containing code to clean up empty folders from user mail files. Yesterday, someone pointed out to me that it doesn't take into account the fact that folders that contain subfolders can be technically empty, in the sense of containing no documents, but we don't want to delete them if they have subfolders which are non-empty -- or if they have subfolders we don't also want to delete. So I came up with a new version of the code that deals with those situations. As bac [read] Keywords: ldd lotus lotusscript application




Created and Maintained by Yancy Lent - About - Blog Submission - Suggestions - Change Log - Blog Widget - Advertising - Mobile Edition