?
Solved

Accessing the Vector returned by ViewEntry getColumnValues

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

764 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