Solved

Accessing the Vector returned by ViewEntry getColumnValues

Posted on 2004-10-18
5
966 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
5 Comments
 
LVL 9

Assisted Solution

by:HappyFunBall
HappyFunBall earned 75 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
This video discusses moving either the default database or any database to a new volume.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now