Solved

Accessing the Vector returned by ViewEntry getColumnValues

Posted on 2004-10-18
5
1,002 Views
Last Modified: 2013-12-18
Hello, I'm trying to access subtotals in an agent using getColumnValues for category ViewEntry's.  getColumnValues returns a Vector.  This is what the Help example does to access the column values from the Vector:

Vector v = entry.getColumnValues();
        for (int i=0; i<v.size(); i++) {
          if (v.elementAt(i) != null) {
            System.out.println("Column " + (i+1) + ":");
            System.out.println("\t" +
            v.elementAt(i).getClass().getName());
            System.out.println("\t" + v.elementAt(i)); } } }

If I only want certain column values, is there a way I can access them using the column name?  Or is there such a thing as a column alias?  Basically, I don't want to rely on the column number in case the columns get rearranged.  Thanks.
0
Comment
Question by:pw05
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 9

Assisted Solution

by:HappyFunBall
HappyFunBall earned 75 total points
ID: 12341620
You can get a handle to the NotesView and then look at the Columns collection, which is a collection of ViewColumns.  Each ViewColumn contains an ItemName property which is the programmatic name of the column (found in the column properites box when viewed via Designer), or the Title property which is the title of the column.
0
 

Author Comment

by:pw05
ID: 12342066
I'm using a ViewNavigator though, so I'm looking through ViewEntry's returned by the ViewNavigator.  Does your comment still apply?  If so, would you please explain a little more?  Thanks.
0
 
LVL 31

Assisted Solution

by:qwaletee
qwaletee earned 75 total points
ID: 12342213
ColumnValues is consistent across both domino.Document and domino.ViewEntry.  The index into teh column vector with match, at any giventime, the values returned by getColumns.  So, before you start, loop through the getColumns vector to find teh item you want.  You can identify the matching item by exact match on formula, title, or ItemName.  usually ItemName is a best bet -- it will return the exact item name if the column directly represents a Notes field.  Otherwise, it will return the "progarmamtic name" of the oclumn, which by default is $nnnn, where nnnn is a serial number assigned to each column as it is created.  You can change this on the advanaced properties tab of the column, to some value you lke and can identify.

Once yu have have idnetified the column from getColumns, you now have an index number that you cna use against getColumnValues()
0
 
LVL 3

Accepted Solution

by:
Andrea Ercolino earned 100 total points
ID: 12346100
And here is a little tip: usually you should use a hidden view for programmatic access, becuase it really pays (in terms of maintenance and performance) to have a view that shows exactly what a script needs.

0
 
LVL 9

Expert Comment

by:HappyFunBall
ID: 12347544
One bit of warning.  The View.Columns property returns more columns that the ViewEntry.ColumnValues collection.  Any column whose formula is a UI-type formula, such as @DocNumber or @IsExpandable will not be returned by the ColumnValues collection.  So make sure to adjust for that if you're view contains those types of columns.  

Best bet is as RAPUTA says to make a hidden view just for this script to use so you can control the columns without disrupting the application.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Email relaying to outside address 4 178
Migration Lotus to Exchange 2016 4 221
Lotus Script - Exporting Attachments and Folder Creation 2 112
xss alert in domino url 9 55
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question