Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Accessing the Vector returned by ViewEntry getColumnValues

Posted on 2004-10-18
5
Medium Priority
?
1,103 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 300 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 300 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 400 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
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…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

963 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