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! :)

Thursday, March 8, 2012

Patch for bug in XSP.partialRefreshGet/-Post in 8.5.3

Someone made a really stupid mistake in the code for XSP.partialRefreshGet/-Post in 8.5.3..

I won't go into specifics of the code as I'm uncertain if it's breaking some license. Let's just say that if they moved a line of code four or five lines upwards, there wouldn't be any bug.

I wrote a simple patch for the bug. Put it in a CSJS library, and your code will work like it did on 8.5.2 (unless I made a stupid mistake).

/**
* Fix for bug with partialRefreshGet/-Post in 8.5.3
*/
(function(){
var oldPartialRefreshGet = XSP.partialRefreshGet;
XSP.partialRefreshGet = function( targetId, options ){
// Convert to array
var argsArray = Array.prototype.slice.apply( arguments );

if( argsArray.length > 1 ){ argsArray[1] = argsArray[1] || {}; }
if( argsArray.length === 1 ){ argsArray.push( {} ); }

oldPartialRefreshGet.apply( XSP, argsArray );
};

var oldPartialRefreshPost = XSP.partialRefreshPost;
XSP.partialRefreshPost = function( targetId, options ){
// Convert to array
var argsArray = Array.prototype.slice.apply( arguments );

if( argsArray.length > 1 ){ argsArray[1] = argsArray[1] || {}; }
if( argsArray.length === 1 ){ argsArray.push( {} ); }

oldPartialRefreshPost.apply( XSP, argsArray );
};
})();


This code should be forwards compatible with future API updates, as it doesn't assume number of arguments in function.

Thursday, January 26, 2012

Runtime optimized JavaScript and CSS - workaround for multiple stylesheets

Update: This workaround is only needed if you use "folders" in the image resource name.
E.g. backgrounds\home.png.

If you have multiple local stylesheets on a page, the CSS files are combined into a single file.

This changes the url to the stylesheet (adds xsp/.ibmmodres/.css after the path to the db).

If you have an image reference like url(image.png), the image can no longer be loaded, as the url is relative to the path of the stylesheet.

To work around this issue, add ../../../ to the image reference.

E.g.
url(../../../image.png)

Thursday, January 5, 2012

Useful tool when working with text files (CSV, source code, etc)

WinGrep is a tool that let's you search one/several folders for parts of strings. It supports searching in zip files, and lets you use Regular Expression (Perl syntax?) for searching strings.

The result pane shows all the matching lines in the file(s) you are searching.

Monday, January 2, 2012

Thing to be aware of when using "Generate unique keys.." in view

I had trouble with a couple of views today. The views had the option Generate unique keys in index checked.

When the views were replicated to other servers, they weren't built. When trying to open them I got the error message Entry not found in index

I found the solution on the Domino forums, add @IsUnavailable($Conflict) to the view selection.

Tuesday, December 13, 2011

ClassNotFoundException with the new Java design element

Last week Vince Shuurman blogged about having to recompile when opening an XPage app in Domino Designer.

I had the same issue. I was using some Java code in an XPage, and every time I opened the app in designer, I got ClassNotFoundException when opening the XPage. A build of the project fixed the issue.

My java code was in the new Java design element (new in Domino 8.5.3), so I suspected that it might have something to do with this.

I moved the code to a "custom" java source folder, and the error went away. Closing/opening the app in Designer did not result in ClassNotFoundException.