How to get in an agent the value in the view and not in the document?

Hello,

I will try to explain my problem (sorry for my english)

I have a view with a column wich contains a specific value.

In my agent, I read the view with no problem by :

Set vue1 = db.GetView( "Tree" )

Set vc1 = vue1.GetAllEntriesByKey(sDomain, True)

For i = 1 To vc1.Count

	Set entry = vc1.GetNthEntry(i)

	Set doc1= entry.Document

	iWrite = 0

	sFullCategory = doc1.Category(0)

                             ....

                             ....

Problem :

I would like to get the value of my second view column (already computed) and not the value of the field ‘category’ in my document as written above.

I want do that because my column contains “shows multiple value as separate entries”

Could you tell me how to do ?

thanks for your help

Nicolas

Subject: How to get in an agent the value in the view and not in the document ?

entry.ColumnValues(1) will get you the value of the 2nd column

Regards,

René

Subject: works fine but type mismatch after many read…

Thanks Rene,

It’s exactly what I want

but I don’t understand why after many reads, I got in console server :

15/02/2008 14:37:45 Agent message: Erreur Agent Scriptzzz number 89 : Erreur: 13 - Type mismatch

where my line is : Print “entry.ColumnValues =” & entry.ColumnValues(1)

my code :

Dim vue1 As NotesView

Dim entry As NotesViewEntry

Set vc1 = vue1.GetAllEntriesByKey(sDomain, True)

For i = 1 To vc1.Count

	Set entry = vc1.GetNthEntry(i)

	Set doc1= entry.Document

	iWrite = 0

	sFullCategory = doc1.Category(0)

Print i

	Print "sFullCategory = " & doc1.Category(0)

	Print "entry.ColumnValues ="& entry.ColumnValues(1)    <---- here

I don’t understand why the problem is at the 74th reads.

the content of the field is not different from another.

Thanks in advance

Nicolas

Subject: RE: works fine but type mismatch after many read…

Best is to run the agent with the debugger. In that case you can see what is in columnvalues(1). The content may be the same, but the data type may be different. (text in the first 73 docs, a number in doc 74)

Also, you can try to change the line into

Print “entry.ColumnValues =”& Cstr(entry.ColumnValues(1))

Subject: RE: works fine but type mismatch after many read…

Infact, the doc 74 contain in ‘Category’ a text list like : “Fournisseur\ROUTE\Zone 05\Espagne”

“Fournisseur\ROUTE\Zone 05\Portugal”

previous record are only text

I don’t understand why, because it’s the raison why I want to use the result in the view and not in the doc, because normally I have 2 line in the view with only 1 text.

I’m disappointed that the display by the veiw don’t mapping the result read !!!

I search with a solution with arry but I don’t know how :frowning:

Subject: RE: works fine but type mismatch after many read…

I understood you had “show multiple values as separate entries” checked. In that case your column always contains 1 line.

But if it is multivalue try:

Dim columnValue as variant

columnValue = entry.ColumnValues(1)

If Isarray(columnValue) Then

Print “entry.ColumnValues =”& Implode(columnValue, “,”)

else

Print “entry.ColumnValues =”& columnValue

end if