Showing posts with label Lotus Notes. Show all posts
Showing posts with label Lotus Notes. Show all posts

Thursday, March 15, 2012

Showing horizontal notes data as vertical in view

Today at work, I needed to transfer some data from a Notes application to SQL. The documents in question were horizontal.

An example of what I mean:
An order form in Notes with five order lines. For each line, there may be five fields that contains information about the order. Making it a total of 25 fields for five order lines.


Traditionally, if you want to show this data in a regular notes view, you have to have a column per field.


Thanks to the way the index is organized in a Notes view, you can show this data vertically using Show multiple values as separate entities.


A summary of the technique:
  • In each column, create a list of the field values that you want to show
  • Each column list has to have equal amount of values
  • Each column has to have Show multiple.. property enabled
  • Only the first column can be sorted (it can be categorized), or you end up with a lot of rows.
    This is probably due to how the index is organized/matching of multiple values

Here's the demoapp I took the screenshots from:
>> Download

Take a look at the Vertical view to see the technique I used.

Thanks to this technique, I can simply pull the data from a view using view entries/column values/send row by row to a stored procedure in SQL. The alternative would be to write code for each field.

Share and enjoy! :)

Monday, June 29, 2009

New NotesUI-bug found in Notes 8.5 (includes workaround)

Update: The bug(?) isn't as serious as I first thought. The settings document wasn't closed, but it was sent to a frameset of another application. In the other application, an action calls NotesUIWorkspace.SetTargetFrame. I'm not sure if it is a bug, that a document from another application ends up in this frameset. For all I know this is just Notes' quirky way of doing things. If I call setTargetFrame("someRandomValue") before NotesUIWorkspace.EditDocument, the code works as designed.

--

I'm back working in the client again. It seems every time I'm working on client code, I discover a new NotesUI-bug. :-\

Purpose: When user tries to create a settings doc, check to see if one already exists. If yes, open the existing doc (by static unid), else set static unid, continue.

I'd have thought it would be as easy as (in PostOpen) Source.Close, NotesUIWorkspace.EditDocument. And it would, if the user was running Notes 8.0.X. In Notes 8.5, the client closes both the "Create Settings" instance, and the LS instance if the user opens the Settings-form when a settings doc already exists (see code below).

The workaround is easy: Source.Close, NotesUIWorkspace.URLOpen

Even though it's easy to make the code work in 8.5, I shudder to think about how many existing applications that's going to misbehave if the user upgrades to Notes 8.5.


Sub Postopen(Source As Notesuidocument)
On Error Goto handleError

Print Source.IsNewDoc 'True then False when settings doc exists

'// If new doc, check for existing settings doc
If Source.IsNewDoc Then
Dim settingsDoc As NotesDocument
Set settingsDoc = s.currentDatabase.GetDocumentByUNID( UNID_SETTINGS )

'// Set static unid on new settings doc
If settingsDoc Is Nothing Then
Source.Document.UniversalID = UNID_SETTINGS
Else
'// Open existing settings doc
Dim ws As New NotesUIWorkspace()
Call ws.URLOpen( settingsdoc.NotesURL ) 'Works
'Call ws.EditDocument( False, settingsDoc ) 'Does not work
Source.Close True
End If
End If

Exit Sub
handleError:
If Err = 4091 Then Resume Next 'Invalid UNID
End Sub


>> Bugreport

Friday, June 5, 2009

Mail from Outlook to Notes/Domino applications without Notes installed

I'm sorry to say that this post will be words only. No juicy code or bug ridden demo applications. Hopefully it will give you ideas on how to make use of this concept in your own applications.

Backstory: A customer of ours needed to get mails from Outlook into a Domino CRM web application. The prerequisite was that the users shouldn't need to install the Notes client.

This was presented to me by my boss over a couple of beers. I more or less immediately thought of the great functionality the Domino server has, that you can set up any NSF as the receiver of mails. If you could tag the mail with values inside Outlook, an agent could process the forwarded mails (add Readers/Authors fields based on customer id/etc.).

I started out with a POP3 Gmail account inside Outlook. I went through most of the writable properties of the mail-object, and struck gold. :)

The mail-object has a property called Category. When the mail is received inside Notes, this field is called Keywords. The field seems to be restricted to ASCII characters (or Gmail/Domino converts it to that). Therefore, the values need to be URL-encoded. From my small tests, everything seems to go through the wire. Line break, international characters, etc.

I send the values in a URL parameter pattern, so they're more readable, but formats like XML, CSV and JSON should work just as well. The only restriction I can think of is the ridiculous 32k limit on fields.

To let the user select the customer ID, I use the WebBrowser control inside a dialog in Outlook. The user interface is more or less a view with some DHTML code. When a user click a table row, I add a class on the row so that the user sees which customer is selected. I collect all the values from the selected table row, and put them inside a hidden field (comma separated). When the user clicks OK in the Outlook-dialog, I use VBA to collect the values from the hidden field. A second dialog is used for some custom fields (document type, date and description). That's about it.

Share and enjoy!

Thursday, May 21, 2009

Help get the NotesUI-bugs in Notes 8.5 fixed

If you're having problems working with the NotesUI classes in Notes 8.5, or are planning to upgrade to Notes 8.5.x in the future/have applications that use the NotesUI-classes. Please contact Lotus Support and open a PMR to request inclusion of the fix in an 8.5 FP.

Thanks, Andre for making people aware of this issue.

Friday, February 13, 2009

Trigger onChange immediately for checkboxes, radiobuttons and comboboxes in the Client

This was a new discovery for me. I mostly work on web applications, but the last week, I've been working in the Client exclusively.



When changing a setting on a combobox, I caught sight of the above setting, "Run Exiting/OnChange events after value change". This little gem changes the behavior of comboboxes, checkboxes and radiobuttons, so that the OnChange/Exiting events fires immediately after the user has changed the value, instead of having to wait until the field loses focus.

The setting is a per field setting, so you can mix and match according to your needs.

Thursday, January 29, 2009

Serious bug in N/D 8.5 standard configuration - NotesUIWorkspace.CurrentDocument returns Nothing

Update: I got a question by mail if this bug is in the Gold release. It is. I'm running Revision 20081211.1925 (Release 8.5).

When debugging code that fetches the active NotesUIDocument from NotesUIWorkspace, NotesUIWorkspace.CurrentDocument randomly (?) returns Nothing. Sometimes the client also crashes when running code that does the above.

A couple of colleagues that work exclusively on the Client have gone back to Notes 8.0.2 because of the problem. Code that's affected by the above problem in the standard client seems to work when running the basic client.

I use this method to run the Basic Client.

A thread about the problem in the Notes 8.5 forum

If you have the same problem, please join in the discussion.

Friday, January 16, 2009

My first bug found in N/D 8.5

When you're working with an application in the new Domino Designer, and open/close the application in the Client, the QueryClose event doesn't get fired.

I had to close DD to get the event to fire. This probably isn't the most serious bug, but it is annoying when working with/testing QueryClose.

Bugreport

Thursday, January 8, 2009

Use "nsd -kill" when killnotes doesn't work

Today, I got a "Shared memory error" after the Notes client crashed.

KillNotes didn't clean all the processes. This resulted in not being able to start Notes again. I did a little search, and found the solution.

I created a small bat-file that executes the NSD-command. If you want to use it, you probably have to change the line that has the path to Notes, "cd \Program Files\lotus\notes\" to fit your environment.

Wednesday, January 7, 2009

Useful new LS-method in Notes 8.5 - NotesDocumentCollection.StampAllMulti

Input parameter, NotesDocument. Add the values you want to stamp the collection with as fields in a (temporary) NotesDocument.

E.g.
Dim s As New NotesSession
Dim doc As New NotesDocument( s.CurrentDatabase )
Call doc.replaceItemValue( "field1", "1" )
Call doc.replaceItemValue( "field2", "2" )

'col is a NotesDocumentCollection
Call col.StampAllMulti( doc )

Thursday, December 4, 2008

(Click to) Sort view after search



Expand "More", to the right of the search-field. Select "keep current order", then click Search.

Friday, September 19, 2008

Processing documents by category in categorized views

Problem: How to process documents in a category (categorized view) in a simple way?

This is a problem I've heard a couple of times at work from the Notes-guys (I'm a Domino/Web-guy). I've tried a couple of approaches/googled, but found nothing. Therefore I archived this problem in my "experiment ideas"-folder.

Today I had a little time to play around, and found a very simple solution.

When you click an item in a view, a couple of properties is set in the NotesUIView. CaretNodeId points to the NoteId of the document that is selected. The gem is that when you click a category, an "invalid" NoteId is set. If you can't get a document from from the db using that NoteId, the item clicked is probably a category.

Now you know the user clicked a category.

Combining the ViewSelection-formula of the view, and the Formula-property of the first column (the column has to point to one field in the document for this to work), you have a valid search-formula for db.search.

Now you know which documents the user want.

Of course, the user don't want to modify documents by category each time they click the category. Add a button that sets an environment variable, and test for the value of that variable in the onSelect-event in the view. If you want to make available several types of action on the documents, use more values.

Now you know when/how the user wants to modify the documents

Problem solved..? :)

As always, blogposts like this are useless without a simple demoapp..
>> DemoApp

If you like/dislike this workaround/hack, please leave a comment.

Update: The onselect event is new in Notes 8. So if you're running on older versions, I guess there's no simple solution. Thanks to Theo for giving me a heads up!

Wednesday, September 10, 2008

Fun with the WebBrowserControl - DemoApp release

I think I've cleaned up the demo-app good enough now.

I added another demo, showing the browser on the onHelp event in Notes/offline Mootools accordion.

Apart from that, I've changed the way I store JS. I now store it in a page, and use the NotesNoteCollection of the db to fetch it (look in the code). This makes it easier to implement in a Template-context.

If you test the app on something else than Notes 8, I'd appreciate feedback (preferably in the comments) on the stability of the demoapp.

To test out making friends, edit a document in the DiscworldCharacters-view (make sure the HTTP-task is running). If you're running the demo on a server, edit the Add friend-button, so that the domain is correct.

The other demos are in the BrowserDemo-form.

>> The WebBrowserControl demoapp

The flash-demos are here

Update: Martin tested the app in N6.53. That makes it at least compatible with N6.5 to N8.02.

Tuesday, September 9, 2008

Fun with the WebBrowser Control - Finishing up

I'm more or less satisfied with what I've accomplished with my experiments.

I'm now able to "bootstrap" (in lack of a better term) a JS-library/HTML to a WebBrowser control. This enables you to write truly offline widgets (no HTTP-task involved) for your notes-apps.

I'm also able to bind LS-functions to the events available in the WebBrowser-control using environment variables and Execute.

I won't be able to clean up the demo-app today. Hopefully I'll be done tomorrow if nothing else comes up.

Until then, I've made another flash showing a youtube-movie inside Notes (for instruction videos/etc.), and logging of navigation (for tracking of online wizards inside Notes/etc.) in the webbrowser using the BeforeNavigate2-event.

If you want me to do make another example of integration with the WebBrowser-control, leave a comment, and I'll see what I can do.

All the flash-demos:
Demo 1 - simple usage
Demo 2 - Web autocomplete to Notes
Demo 3 - Offline Mootools-demo
Demo 4 - Web Autocomplete - Add friends
Demo 5 - Loading Youtube-movies/logging navigation

Monday, September 8, 2008

Fun with the WebBrowser Control - Making friends

The demoapp has gone through serious a serious rewrite to make the code more reusable/flexible. I've also worked a little bit on dynamically binding events through environment variables and execute. Sadly I haven't found a way of truly dynamically binding events (On Event..).

Some of the methods for the browser-class I use are now also chainable. E.g.
Dim browser As New Browser
Call browser.setSize(300, 400).openUrl("http://google.com")


Todays flash shows a little friend-making:



The document being edited has a hidden multi-value field that holds ID's to other "Discworld Characters". When a character is selected in the lookup, the id of that document is put inside a hidden field in the browser document.

When the browser is closed, the values is picked out of the browser document and added to the "friends-list". Then the document is refreshed/a lookup is run to update the list of friends (a computed for display field). This is achieved by binding a function-call to the windowclosing-event of the control.

I'm still not ready to release the demoapp. If I do that, I'm probably going to stop experimenting on the WebBrowser, and start mucking with XPages..

Friday, August 22, 2008

Fun with the WebBrowser Control pt 3

I've come a little farther in my experimentation.

Today's flash show offline DHTML. The flash doesn't do the FX justice btw. When I'm done tinkering, you'll get to see the real deal.




I put the mootools framework JS inside a RichText-item on a document. Fetch the js as a string. Write the string and some HTML to the WebBrowser-control. Hey Presto! Offline DHTML.

My brain is fried right now, so no more programming today.. :)

Wednesday, August 20, 2008

Fun with the WebBrowser Control pt 2

Getting to know the object more and more.

Today's flash shows capturing events from the browser-control, and picking values from the document inside the control.



This resource from Microsoft has helped me along somewhat. Only a fraction of the methods/events/properties documented is available in Notes though.

The demoapp is still not ready, as I'm still not finished investigating possibilities.. :)

Friday, August 8, 2008

Fun with the WebBrowser control

I'm messing around with the WebBrowser Control again.. :)

I planned on getting a demoapp together today, but I had to find a workaround for showing/hiding the layer holding the webbrowser, and that took most of my time. Hide-when doesn't work properly with the WebBrowser-object.

At least I want to show some fruits of my labor. A small flash animation showing scripting between Notes and the control/putting the WebBrowser control inside a layer.




The promt/messagebox in the demo are Notes'. You can tell from how they look, compared to the browser's alert/prompt.

I'll probably post a demoapp/more info when I have something more useful..

Thursday, March 13, 2008

Notes 8 Classic - working undercover?

I just started using Notes 8.0.1 this week. Some things I love, and some things annoy me.

Like this one:


I was working on a calendar-entry, when suddenly the classic client popped up. I can't close it by itself. When I close the standard client, this closes as well.

Don't know if this means that the classic client is used as a go-between for Domino Designer/old Notes apps and Notes 8 Standard Client?

Tuesday, December 4, 2007

Rant about the apparent lack of "serious" Notes/Domino programmers

Started of as a comment on "The reason the Domino Development Platform Isn't Taken Seriously", where Craig asks if it's time for the DominoDevs to grow up. My rant is also influenced by the comments posted on Nathan's "Sanity Check" that OO is the way to go/most N/D developers are lazy.

Start rant:
This is just a wild guess, but don't think that the majority of N/D developers are willing/able to make the effort to write "serious" code.

Then again, how many applications need the complexity that is Java/OO/Inheritance/MVC/etc?

The recent discussions on the future of N/D remind me a lot about discussions about JavaScript, which also has had the toy stigma for most of it's life.

It's not until the Ajax-term is coined by a well respected person in the community, Jesse James Garrett, that suddenly JavaScript is THE language to learn. Then Douglas Crockford steps in and show the "serious programmers" all the amazing stuff you can do in JS, and all of a sudden, all platforms must have JavaScript.

Now the "serious programmers" want to tighten JS (with EcmaScript 4), and make it more serious (or more precisely, make it fit their world..?).

JavaScript is a forgiving language, just as LS. There is a lot of awful code being written in JS, making sites/applications brittle/insecure. If you force strong typing/classical inheritance/etc. on all JavaScript-developers (as some feel that EcmaScript 4 will), how many are you going to have left? Will the tightening of the language be worth the loss? Is the proposed tightening of the N/D-platform going to be worth the loss of less advanced programmers?

I believe that what we as a community (and Notes/Domino as a platform) need, are people who love and understand what is great about the platform, and also are able to sell the concept to developers -and- IBM. Until I see the next designer, I'm firmly convinced that the decision makers of Lotus/IBM doesn't understand what is great about the platform. From looking the latest releases (6/7/8), they see it as a collaboration/mailing platform. N/D isn't great because IBM has made a great mail/calendar application with it, but maybe the mail application is so great because of the (mysterious/genious) concept that is Notes/Domino..?

Regarding lazy/untrained developers:
Great code != Great application from the users perspective, just as Horrible code != Horrible application. Great code will probably lead to a more stable/secure/maintainable/expensive application.

If you want N/D developers to write serious code, and you believe you know how to teach them, why not go together with other great minds and write a book to enlighten them? There must be publishers willing to still publish N/D books..?

With all the Agile development books coming out recently, where is "Agile application development with Notes/Domino" (horrible title, I know).

Other titles I'd like to see:
"Web 2.0 with Domino" (although I hate the term web 2.0, it sells)
"Rich Internet Applications with Domino"
"Enterprise applications with Domino 8"
"Object Orientated programming in LS for dummies"
"Taking advantage of DB2 with Domino 8"
etc. etc.

/rant

Friday, November 30, 2007

Rant about Notes 8, Lotus/IBM

Nathan writes "Where is the love".

More and more, I think, "Where is the hate?" :)

I was on the point of starting a rant in the comment section on the post, but after half an hour of writing/rewriting my frustrations with (my perceived) impression of IBM/Lotus directions, I decided to keep the rant on my blog.

Every week 5+ blogposts enter my RSS-reader about how great Notes 8 is. Almost nothing about the bugs/bad integration between the new client and Domino Designer (maybe I am the only one having problems), or how, once again, the majority (the non-java) of developers were screwed over in a release.

What mostly irritates me is that the scripting tools in Domino Designer has less functionality your average notepad-clone. You (Lotus/IBM) want me to learn Java? Then give the Designer team the resources to make tools that doesn't stink of the 1990s.

It doesn't make me happy when I think about how much resources they probably put into making 100+ different-looking icons look more or less like one (orange-ish) icon.

From my point of view, it looks like the marketing-department in Lotus/IBM has a LOT more power/resources than the developers of Notes/Domino.

Most of what's great in Notes/Domino has been there since pre version 7. Of all of the things the developer-community has asked for (in partner-/public forums), what has been implemented?

Domino Designer in Eclipse? Great!! When did you say it's going to be released?

If you want to rant about how wrong I am, please do.. I don't deny that I could be. :)