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
Solved

Accessing the Vector returned by ViewEntry getColumnValues

Posted on 2004-10-18
5
993 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
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying 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

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

791 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