Search DominoPower's 11,441 Lotus-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Twitter Feed Click here for the Twitter feed.
Linking Domino to Excel via XML (continued)

A table header for our example table could be:

<TABLE BORDER=1 CELLPADDING=2>
<TR>
<TH>Year
<TH>Quarter
<TH>Area
<TH>Revenue
<TH>Net Profit

The footer need be no more than:

</TABLE>

That's it! Your Notes view is now a neatly formatted table that can be easily viewed by browsers. When saved to disk, the view can be opened by Excel as a spreadsheet. The only thing it lacks, as your customers will soon tell you, is a total.

Summing it Up
Excel 97 supports some basic XML additions that allow you to build in formula to this table. In principle, this is trivially simple, for example:

<TD FORMULA="=SUM(D2:D34)">

There are some complications in actually using this simple code, however:

  • If you only use the formula, browser users will see no totals.

  • When summing up a dynamic table, you have no idea of what range to use for the sum.

  • When using formula within the rows, how do you know the current row number?

The key to solving the first two obstacles is to create another, parallel Notes view. Doing so allows you to use the @SUM and @DBCOLUMN commands to work out a static total for browser users, and the @ELEMENTS together with @DBCOLUMN to calculate how big that dynamic range is.

To sum up the Net Revenue column, you must create two computed fields on the Notes form, as in this example (where Net Profit is the 8th column in the parallel Notes view):

Total_NetProfit, formula @Sum(@DbColumn("";"";"Notes View";8))
RowCount_NetProfit, formula @Elements(@DbColumn("";"";"Notes View";8))+1

(The row count is incremented by one to take into account the header row).

With these you have everything need to build the full formula, as you can see Figure C:

FIGURE C

Here's some sample code to provide a column total for both Excel and Web browser.

When browser users see this view, they will have the value of the Notes field Total_NetProfit as the total. When the sheet is loaded into Excel, the =SUM formula will be used instead, allowing the Excel user to play with the figures and have the totals automatically recalculate.

Row formulae
If you've grasped the previous concept, you might think that putting formulae into each row would be as simple as:

"<TD ALIGN=RIGHT FORMULA=\" =E"+@text(@docnumber)+"-D"+@text(@docnumber)\">"+@Text(GrossProfit;"(F,2")+"</TD>"

This will work for tables without headers, where @DocNumber is the same as the row number. However, if you have a header row you need @DocNumber plus 1, and that's where you hit a Notes wall. It simply can't be done, not even by converting the text to a number and back again. The @DocNumber formula returns the current line number as "special text" which is prevented from ever being turned into a number.


« Previous  ·  1  ·  2  ·  3  ·  4  ·  5  ·  Next »
Other articles you might like
Home > Strategies > Interoperability (15 articles)
   A Sametime plugin for Trillian
   Integrating Twitter with an IBM internal social network
   Fun with Sametime and Skype
Home > Internet Technologies > XML (11 articles)
   How to create a Web service to extract data from XML documents
   Building an XML based Content Management System using Lotus Domino: wrapping it up
   Building an XML based Content Management System using Lotus Domino: overview of the content administration system
Home > Microsoft Technologies > Office (7 articles)
   DAMO deep-six: is there a future for Outlook/Domino integration?
   Quick guide to using the Microsoft Outlook 2002 Connector with a Domino server
   How to easily connect Notes and Microsoft Office
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Recent DominoPower Articles
Application development, William Shatner, and the origin of the universe
Learn Domino Designer 8.5 for free
The (near) future of Sametime, Quickr, Connections, and Symphony
Inside the IBM Innovations lab
Lotusphere 2010: Hot fixes and cool news for Notes, Domino, and LotusLive
Lotusphere 2010: mobility and collaboration
2010: A Lotusphere of change
Latest Lotus Headlines
Xpages not loading? JVM errors? - Solution
How to implement an iCalendar feed into your Notes calendar with XPages
DWA Hotfixes for Domino 8.5.1FP1 - A Gotcha
IBM Adds DB2 to Lotus Foundations SMB Package
SNTT : XPages onclick Ghosts in the machine
Ports used by Lotus Sametime 8.5 servers
Exploring a Domino Date Bug
>> Read all the news
More from the ZATZ journals
Computing Unplugged: The iPad defenders have spoken
David Gewirtz Online: CNN commentary and analysis
OutlookPower: More about disappearing text
-- Advertisement --

Learn Notes and Domino 8 at your place and pace!
Learn Notes and Domino in your office and/or home! TLCC's highly acclaimed distance learning courses for users, developers, and admins will enhance your career and your resume.

The many included activities and demos will make you a pro! Expert instructor help is a click away.

Click here to try a FREE demo course!!

-- Advertisement --

Teamstudio Edition 25 has shipped
It's finally here! Now that Teamstudio Edition 25 has shipped, listen to our latest Tool Time audio program to find out what's changed. Updates to all your favorite Teamstudio tools will be discussed.

Plus, you'll get an introduction to Teamstudio Undo (formerly known as Teamstudio Snapper).

Tap here to get started!

ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login