View Full Version : Help! Categorized View.
sdlfly2000
20 Apr 2008, 5:08 AM
The Ext.nd frame works great, and it make a big progress in domino web face.
But it doesn't support the mulit-categorized view, which makes me hesitate to use in my new website.
By now, I have successfully lauch the single categorized view with the code:
Ext.onReady(function(){
globalUI = new Ext.nd.UIView({
viewName:"WebTestView",
gridConfig: {
renderTo: "view-test",
width:395,
height:200
},
showSearch: false,
showSingleCategory: "abc"
});
});
However, that is not enough. I don' t like to show categorized view with combo text and prefer the +/- icon.
Also, the thread (http://extjs.com/forum/showthread.php?t=9495&highlight=categorized+view) tells me the mulit-categorized view has been developed. I still can't lauch it correctly.
Anybody can help me?
Thanks
jratcliff
21 Apr 2008, 9:17 AM
The next beta release has the categorized view support. We are close to releasing it. If you want, PM me your email address and I can send you a pre-release copy of it.
~Jack R.
sdlfly2000
22 Apr 2008, 4:39 AM
Thank you!!!
I'm looking forword to the next beta edition.
That's kind of you to sent to me trial nsf.
My E-mail is jayshi@apac.ko.com
renatewr
16 Jun 2008, 6:00 AM
Hi! Is it posible to have a pre-relase copy of that categorized view-support version? All the views happens to be categorized in my db :-(
jratcliff
16 Jun 2008, 6:29 AM
Sure, just PM me with the email address you want me to send it to.
And again, apologies to everyone for not having an official beta to post. Rich and I are still working out some of the licensing issues and a few other things.
~Jack R.
DBaker
17 Jun 2008, 12:28 AM
Jack -
Please send a pre-release copy to me as well...
dell.baker@syqwest.com
Thanks.
JuanPalomo
17 Jun 2008, 12:37 PM
Hi Jack,
Could you please send me a copy to me as well :D
My email is: ocean_surf_1977@hotmail.com
Thank you very much
Fredric Berling
17 Jun 2008, 10:16 PM
Mr Jack!
Can you please send me a copy too?
fbe@i-seven.com
Thanks alot!
dominodeviant
17 Jun 2008, 10:17 PM
The next beta release has the categorized view support. We are close to releasing it. If you want, PM me your email address and I can send you a pre-release copy of it.
~Jack R.
dominodeviant@gmail.com
Really appreciate it
gandalf
18 Jun 2008, 11:09 PM
... and me too please ;-)
griva@brainsystem.org
Thanks you !!
mmiedona
19 Jun 2008, 4:16 AM
and if you could, please send me a copy as well.
mmiedona@ansell.com
Regards,
Mike
chiphi13
19 Jun 2008, 5:19 AM
Could I also get a copy: steven.parsley@gmail.com
forefront
19 Jun 2008, 7:30 PM
Me too please.;)
eMail:achir.lui@gmail.com.
Thank you very much.
mth96a
20 Jun 2008, 7:57 AM
Would it be possible to set a style to the total text so we can make it a different color, maybe a line above or below? What about alternate row colors? Thanks
jratcliff
20 Jun 2008, 8:47 PM
OK, for all that sent their email, I've sent you a pre-release copy of the next beta which has categorized view support. Please let Rich and I know what you think and report back any bugs/suggestions you have.
~Jack R.
jratcliff
20 Jun 2008, 8:48 PM
I don't see why not. I'll take a look at this over the weekend.
Would it be possible to set a style to the total text so we can make it a different color, maybe a line above or below? What about alternate row colors? Thanks
hirecules
21 Jun 2008, 10:07 AM
I know you have been swamped with requests for the pre-release copy.
one more for me please.
My e-mail address is ed@hirecules.com
Thanks in advance!!
JuanPalomo
21 Jun 2008, 11:48 AM
Hi Guys,
Really nice the categorized views!!
I've got i little problem...before i updated the new files he draw my outline icons OK...now he draw me big icons.. how can i let it like before? (with the small icons)
Please see picture 1 (OK) and picture 2(No OK).
Could it be possible to give some colours in the title of the columns? (please see picture 3)
Thanks in advance!!!
alan95_00
25 Jun 2008, 5:53 AM
Can you please send me a copy?
email: alan95_00@yahoo.com:)
jratcliff
25 Jun 2008, 10:02 AM
Hi Guys,
Really nice the categorized views!!
I've got i little problem...before i updated the new files he draw my outline icons OK...now he draw me big icons.. how can i let it like before? (with the small icons)
Please see picture 1 (OK) and picture 2(No OK).
Could it be possible to give some colours in the title of the columns? (please see picture 3)
Thanks in advance!!!
Well, read this thread
http://extjs.com/forum/showthread.php?t=26210
We add a custom class for outline icons and in our domino.css file we set their width/height to auto so that we can honor whatever size the developer wants the icon to be. We did this because Ext forces the size to be 16px X 18px and Domino's default icons were 19px X 16px and thus they were getting squished width wise and stretched height wise. We now allow you to put in any size icon you want.
For your fix, you can either resize your icons to be 16px X 18px or overide our class in your own css file
Here's what we have
.xnd-icon {
width: auto!important;
height: auto!important;
}
And you can override it by doing this
.xnd-icon {
width: 16px;
height: 18px;
}
~Jack
psolano
25 Jun 2008, 10:38 AM
The next beta release has the categorized view support. We are close to releasing it. If you want, PM me your email address and I can send you a pre-release copy of it.
~Jack R.
Can you email me the .nsf too?
I'm new using Extnd and I'll like to get some documentation of function, ways to modify elements properties, namepicker, open documents in new windows, dialog windows, etc.
I'm currently working with the Beta release and the only documentation I have is the LS presentation.
psolanog@gmail.com
Regards,
Pablo Solano
fangstern
25 Jun 2008, 1:34 PM
please send me a copy as well fangstern@hotmail.com
JuanPalomo
26 Jun 2008, 1:33 AM
Jack, THANK YOU VERY MUCH!!! works great now!!
Well, read this thread
http://extjs.com/forum/showthread.php?t=26210
We add a custom class for outline icons and in our domino.css file we set their width/height to auto so that we can honor whatever size the developer wants the icon to be. We did this because Ext forces the size to be 16px X 18px and Domino's default icons were 19px X 16px and thus they were getting squished width wise and stretched height wise. We now allow you to put in any size icon you want.
For your fix, you can either resize your icons to be 16px X 18px or overide our class in your own css file
Here's what we have
.xnd-icon {
width: auto!important;
height: auto!important;
}
And you can override it by doing this
.xnd-icon {
width: 16px;
height: 18px;
}
~Jack
blademansw
4 Jul 2008, 6:35 AM
Hi Jack
Have you got RestrictToCategory working with the categorised views?
Cheers
Scott
jratcliff
5 Jul 2008, 6:15 PM
As far as I know it works. I've updated the example in the demo database on OpenNTF to show it in action.
http://www.openntf.org/EXTND/demo.nsf/demos/singlecategory-views.html
galdaka
6 Jul 2008, 11:02 PM
As far as I know it works. I've updated the example in the demo database on OpenNTF to show it in action.
http://www.openntf.org/EXTND/demo.nsf/demos/singlecategory-views.html
Not work ;)
error: this.sess has no properties
Thanks in advance,
tarikonen
7 Jul 2008, 1:56 AM
Hi Jack, Can you please send me a copy?
email: alexlittletriumph@msn.com
jratcliff
7 Jul 2008, 7:29 AM
Not work ;)
error: this.sess has no properties
Thanks in advance,
Oops. Try it now. In preparation for an upcoming article about Ext.nd on The View (http://eview.com), I forgot that I had resigned the database with an ID that hasn't been cross-certified on the OpenNTF server. All is fixed now.
psolano
8 Jul 2008, 12:50 PM
I'm interested in seeing how to implement the Single Category...
As far as I know it works. I've updated the example in the demo database on OpenNTF to show it in action.
http://www.openntf.org/EXTND/demo.nsf/demos/singlecategory-views.html
TheSwiss
8 Jul 2008, 9:54 PM
The next beta release has the categorized view support. We are close to releasing it. If you want, PM me your email address and I can send you a pre-release copy of it.
~Jack R.
And me please.:D
abertisch@romandie.com
emendez
9 Jul 2008, 2:24 PM
Jack:
Please send me a copy as well:
edmundm at gmail.com
Thanks.
ingkat
10 Jul 2008, 5:53 AM
Please Jack send me a copy
eingkoul@yahoo.ca
gandalf
15 Jul 2008, 2:39 AM
Hi jack,
categorized views seem to work very well, but I have a question: search, in categorized view, seems to return only not categorized columns.
I try to explain: this is my view and the categorize columns is
Contract + "-" + Customer Name
http://www.brainsystem.org/Web/Portalebs.nsf/view1.jpg
I want to search customer "Ali".
The result of the search is
http://www.brainsystem.org/Web/Portalebs.nsf/view2.jpg
How can I obtain, from a search, also the categorized columns?
Thanks in advance and sorry about my bad English.
Mike Amberg
24 Jul 2008, 7:32 AM
Can you please send me a copy too?
mamberg@hellmann.net
Thanks
jratcliff
25 Jul 2008, 7:58 AM
Hi jack,
categorized views seem to work very well, but I have a question: search, in categorized view, seems to return only not categorized columns.
I try to explain: this is my view and the categorize columns is
Contract + "-" + Customer Name
http://www.brainsystem.org/Web/Portalebs.nsf/view1.jpg
I want to search customer "Ali".
The result of the search is
http://www.brainsystem.org/Web/Portalebs.nsf/view2.jpg
How can I obtain, from a search, also the categorized columns?
Thanks in advance and sorry about my bad English.
Well, we're just return the results the way Domino natively returns them and that is without the categories. I'll add this to our list of enhancements to see how we can do this.
The good news is that instead of just doing a /db/view?SearchView we are using an agent that just formats the search results the way Domino natively does it with ?SearchView so we do have complete control of this so perhaps we can include the categories. Just not sure if you could expand/collapse them though from within a search.
jratcliff
25 Jul 2008, 7:59 AM
Can you please send me a copy too?
mamberg@hellmann.net
Thanks
On it's way! Let us know how the categorized views work for you.
jlehmann
25 Jul 2008, 8:17 AM
I'd like to try these categorized views as well. Can you send me a copy too?
lehmann@nauticom.net
Thanks
martijnm
30 Jul 2008, 1:16 AM
Can you send it to me too? martijn.mulder@gmail.com
thanks
Sure, just PM me with the email address you want me to send it to.
And again, apologies to everyone for not having an official beta to post. Rich and I are still working out some of the licensing issues and a few other things.
~Jack R.
alex005
14 Aug 2008, 9:56 PM
Can you please send me a copy too?
voip005@hotmail.com
Thanks
ck2978
18 Aug 2008, 8:42 PM
Hi Jack,
Could you please send me a copy to me as well
My email is: chinkun.huang@gmail.com
Thank you very much;)
vijay.tilak
19 Aug 2008, 5:06 AM
Hi Jack Cld u plz send me a copy of the pre release version?....
email : vijay.tilak@ae.ey.com
Thanks in Advance,
Vijay. :)
emartins
29 Aug 2008, 5:13 AM
Could you please send me a copy as well
My email is liseam_em@yahoo.fr
Thanks a lot
cropar
30 Aug 2008, 3:57 AM
Please send me a copy if possible.
I would also like to compliment you on your work. This is a great addition to the Domno community!
emorillas
3 Sep 2008, 10:02 AM
Please send me a copy if possible.
edumorillas@hotmail.com
kerocs
4 Sep 2008, 8:33 AM
I'm checking for the next release two times a day. I thought it was announced 'unofficially' end of august.
If it would still take some time then I would kindly ask to send me copy at kerocs@kerocs.com
I'm looking forward to both the categorized views and the dominoui new layout possibilities.
keep up the good work, you are my only hope in providing me the tools to make splendid websites a minimum of time.
jratcliff
6 Sep 2008, 9:25 AM
OK, I think I've caught up with sending out the pre-release to those who requested it. I believe one or two of you I still needed an email address so PM me that info.
Also, (and I know we've been saying this for months) but we are trying to get this next beta posted asap that has the categorized view support. We are already working on beta 2 that will give you the ability to build complex layouts...so stay tuned for that. :)
odishon
8 Sep 2008, 4:18 AM
Very much looking forward to the Beta2.. I think it's better to wait for it then to just yell now and get a beta 1.213 or whatever that would be.
Can't wait to get my hands on the 2nd beta.. it is such a cool framework!
erenault
30 Oct 2008, 7:31 AM
Hello,
if you like me you are views categories with formulas and columns hidden and you want to search into, I adapted the code of the agent SearchView :
Sub Initialize
%REM
This agent can be called from the web to search any view and return results in the
same format as the ?ReadViewEntries command. This was created for use with the
NotesView2 class v1.3 and above.
%END REM
On Error Goto ErrorHandler
Dim session As New NotesSession
Dim dbSearch As NotesDatabase
Dim colEntries As NotesViewEntryCollection
Dim vwSearch As NotesView
Dim entryResult As NotesViewEntry
Dim docCurrent As NotesDocument
Dim docResult As NotesDocument
Dim strQuery As String
Dim strDb As String
Dim strView As String
Dim vwRestrictSearch As notesViewEntryCollection
' variables for single category search
Dim strRTC As String
Dim columnRTC As NotesViewColumn
Dim strRTCFormula As String
Dim intMax As Integer
Dim lngCount As Long, i As Long
Dim lngStart As Long, lngEnd As Long
Dim strParameters As String
Dim lngResults As Long
Dim tmpString As String
Dim x As Integer
Dim nbColDisplay As Integer
'start the xml document
Print "Content-Type:text/xml;"
Print "<?xml version=""1.0"" encoding=""iso-8859-1""?>"
'first we get the search parameters out of the querystring
'db, vw, query, searchmax, count, and start
Set docCurrent = session.DocumentContext
strParameters = docCurrent.GetItemValue("Query_String")(0)
strDb = GetParameter("db",strParameters)
strDb = Replace(Strright(strDb,"/"),"/","\")
strView = GetParameter("vw",strParameters)
strQuery = GetParameter("query",strParameters)
intMax = 0
If Isnumeric(GetParameter("searchmax",strParameters)) Then intMax = Cint(GetParameter("searchmax",strParameters))
lngCount = 100
If Isnumeric(GetParameter("count",strParameters)) Then lngCount = Clng(GetParameter("count",strParameters))
lngStart = 1
If Isnumeric(GetParameter("start",strParameters)) Then lngStart = Clng(GetParameter("start",strParameters))
'now we get the view to search
Set dbSearch = session.GetDatabase("",strDb,False)
Set vwSearch = dbSearch.GetView(strView)
If vwSearch.IsCategorized Then
' check for RestrictToCategory because if one exists, we have to adjust the columnnumber attribute
' and we will need to tweak the strQuery to also search on the category
strRTC = GetParameter("RestrictToCategory",strParameters)
Set vwRestrictSearch = vwSearch.GetAllEntriesByKey(strRTC, True) 'exact match on category
'now we run the search on collection restrictTocategory
Call vwRestrictSearch.FTSearch(strQuery,intMax)
On Error Goto ErrorHandlerEntries
'now we spit out the results
Print "<viewentries toplevelentries=""" & Cstr(lngResults) & """>"
Set colEntries = vwRestrictSearch
lngResults = colEntries.Count
nbColDisplay = 0
Else
'now we run the search
lngResults = vwSearch.FTSearch(strQuery,intMax)
On Error Goto ErrorHandlerEntries
'now we spit out the results
Print "<viewentries toplevelentries=""" & Cstr(lngResults) & """>"
Set colEntries = vwSearch.AllEntries
nbColDisplay = - 1
End If
'set the starting point for the loop
If lngStart > lngResults Then lngStart = lngResults
'set the ending point for the loop
lngEnd = lngStart + lngCount - 1
If lngEnd > lngResults Then lngEnd = lngResults
'now loop through the appropriate subset of results and print out a viewentry tag for each one
i = lngStart
While i <= lngEnd
Set entryResult = colEntries.GetNthEntry(i)
If Not entryResult Is Nothing Then
Set docResult = entryResult.Document
Print "<viewentry position=""" & Cstr(i) & """ unid=""" & Cstr(docResult.universalID) & """ noteid=""" & Cstr(docResult.NoteID) & """ siblings=""" & Cstr(entryResult.SiblingCount) & """>"
x = 0
Forall value In entryResult.ColumnValues
If Not vwSearch.Columns(x).isCategory Then
If Not vwSearch.Columns(x).IsHidden Then
tmpString = ""
tmpString = tmpString + "<entrydata columnnumber=""" & Cstr(nbColDisplay) & """ name=""" & vwSearch.Columns(x).itemName & """>"
tmpString = tmpString + "<text>" & XMLEscape(Cstr(value)) & "</text>"
tmpString = tmpString + "</entrydata>"
Print tmpString
Else
nbColDisplay = nbColDisplay - 1
End If
Else
If x > 1 Then
tmpString = ""
tmpString = tmpString + "<entrydata columnnumber=""" & Cstr(nbColDisplay) & """ name=""" & vwSearch.Columns(x).itemName & """>"
tmpString = tmpString + "<text>" & XMLEscape(Cstr(value)) & "</text>"
tmpString = tmpString + "</entrydata>"
Print tmpString
Else
nbColDisplay = nbColDisplay - 1
End If
End If
x = x + 1
nbColDisplay = nbColDisplay + 1
End Forall
Print "</viewentry>"
End If
i = i + 1
Wend
AtEnd:
Print "</viewentries>"
Exit Sub
ErrorHandler:
Msgbox "<error>" & "Error in SearchView: " & Error & "---at " & Erl & "</error>"
Print "<error>" & "Error in SearchView: " & Error & "---at " & Erl & "</error>"
Exit Sub
ErrorHandlerEntries:
Msgbox "<error>" & "Error in SearchView: " & Error & "---at " & Erl & "</error>"
Print "<error>" & "Error in SearchView: " & Error & "---at " & Erl & "</error>"
Resume AtEnd
End Sub
Bye
jratcliff
30 Oct 2008, 8:16 AM
so what lines in the code did you change?
erenault
30 Oct 2008, 8:29 AM
so what lines in the code did you change?
I add the red color in my code ;)
Bye
erenault
31 Oct 2008, 1:48 AM
BE careful, there was a bug in my code (in red)
Hello,
if you like me you are views categories with formulas and columns hidden and you want to search into, I adapted the code of the agent SearchView :
Sub Initialize
%REM
This agent can be called from the web to search any view and return results in the
same format as the ?ReadViewEntries command. This was created for use with the
NotesView2 class v1.3 and above.
%END REM
On Error Goto ErrorHandler
Dim session As New NotesSession
Dim dbSearch As NotesDatabase
Dim colEntries As NotesViewEntryCollection
Dim vwSearch As NotesView
Dim entryResult As NotesViewEntry
Dim docCurrent As NotesDocument
Dim docResult As NotesDocument
Dim strQuery As String
Dim strDb As String
Dim strView As String
Dim vwRestrictSearch As notesViewEntryCollection
' variables for single category search
Dim strRTC As String
Dim columnRTC As NotesViewColumn
Dim strRTCFormula As String
Dim intMax As Integer
Dim lngCount As Long, i As Long
Dim lngStart As Long, lngEnd As Long
Dim strParameters As String
Dim lngResults As Long
Dim tmpString As String
Dim x As Integer
Dim nbColDisplay As Integer
Dim nbColDisplayDefault As Integer
'start the xml document
Print "Content-Type:text/xml;"
Print "<?xml version=""1.0"" encoding=""iso-8859-1""?>"
'first we get the search parameters out of the querystring
'db, vw, query, searchmax, count, and start
Set docCurrent = session.DocumentContext
strParameters = docCurrent.GetItemValue("Query_String")(0)
strDb = GetParameter("db",strParameters)
strDb = Replace(Strright(strDb,"/"),"/","\")
strView = GetParameter("vw",strParameters)
strQuery = GetParameter("query",strParameters)
intMax = 0
If Isnumeric(GetParameter("searchmax",strParameters)) Then intMax = Cint(GetParameter("searchmax",strParameters))
lngCount = 100
If Isnumeric(GetParameter("count",strParameters)) Then lngCount = Clng(GetParameter("count",strParameters))
lngStart = 1
If Isnumeric(GetParameter("start",strParameters)) Then lngStart = Clng(GetParameter("start",strParameters))
'now we get the view to search
Set dbSearch = session.GetDatabase("",strDb,False)
Set vwSearch = dbSearch.GetView(strView)
If vwSearch.IsCategorized Then
' check for RestrictToCategory because if one exists, we have to adjust the columnnumber attribute
' and we will need to tweak the strQuery to also search on the category
strRTC = GetParameter("RestrictToCategory",strParameters)
Set vwRestrictSearch = vwSearch.GetAllEntriesByKey(strRTC, True) 'exact match on category
'now we run the search on collection restrictTocategory
Call vwRestrictSearch.FTSearch(strQuery,intMax)
On Error Goto ErrorHandlerEntries
'now we spit out the results
Print "<viewentries toplevelentries=""" & Cstr(lngResults) & """>"
Set colEntries = vwRestrictSearch
lngResults = colEntries.Count
nbColDisplayDefault = 0
Else
'now we run the search
lngResults = vwSearch.FTSearch(strQuery,intMax)
On Error Goto ErrorHandlerEntries
'now we spit out the results
Print "<viewentries toplevelentries=""" & Cstr(lngResults) & """>"
Set colEntries = vwSearch.AllEntries
nbColDisplayDefault = 0
End If
'set the starting point for the loop
If lngStart > lngResults Then lngStart = lngResults
'set the ending point for the loop
lngEnd = lngStart + lngCount - 1
If lngEnd > lngResults Then lngEnd = lngResults
'now loop through the appropriate subset of results and print out a viewentry tag for each one
i = lngStart
While i <= lngEnd
Set entryResult = colEntries.GetNthEntry(i)
If Not entryResult Is Nothing Then
nbColDisplay = nbColDisplayDefault
Set docResult = entryResult.Document
Print "<viewentry position=""" & Cstr(i) & """ unid=""" & Cstr(docResult.universalID) & """ noteid=""" & Cstr(docResult.NoteID) & """ siblings=""" & Cstr(entryResult.SiblingCount) & """>"
x = 0
Forall value In entryResult.ColumnValues
If Not vwSearch.Columns(x).isCategory Then
If Not vwSearch.Columns(x).IsHidden Then
tmpString = ""
tmpString = tmpString + "<entrydata columnnumber=""" & Cstr(nbColDisplay) & """ name=""" & vwSearch.Columns(x).itemName & """>"
tmpString = tmpString + "<text>" & XMLEscape(Cstr(value)) & "</text>"
tmpString = tmpString + "</entrydata>"
Print tmpString
Else
nbColDisplay = nbColDisplay - 1
End If
Else
If x > 1 Then
tmpString = ""
tmpString = tmpString + "<entrydata columnnumber=""" & Cstr(nbColDisplay) & """ name=""" & vwSearch.Columns(x).itemName & """>"
tmpString = tmpString + "<text>" & XMLEscape(Cstr(value)) & "</text>"
tmpString = tmpString + "</entrydata>"
Print tmpString
Else
nbColDisplay = nbColDisplay - 1
End If
End If
x = x + 1
nbColDisplay = nbColDisplay + 1
End Forall
Print "</viewentry>"
End If
i = i + 1
Wend
AtEnd:
Print "</viewentries>"
Exit Sub
ErrorHandler:
Msgbox "<error>" & "Error in SearchView: " & Error & "---at " & Erl & "</error>"
Print "<error>" & "Error in SearchView: " & Error & "---at " & Erl & "</error>"
Exit Sub
ErrorHandlerEntries:
Msgbox "<error>" & "Error in SearchView: " & Error & "---at " & Erl & "</error>"
Print "<error>" & "Error in SearchView: " & Error & "---at " & Erl & "</error>"
Resume AtEnd
End Sub
Bye
jratcliff
31 Oct 2008, 8:59 AM
I add the red color in my code ;)
Bye
Oops! I missed that!
erenault
4 Nov 2008, 1:49 AM
I changed the code to handle columns with dates :
[code]
Sub Initialize
%REM
This agent can be called from the web to search any view and return results in the
same format as the ?ReadViewEntries command. This was created for use with the
NotesView2 class v1.3 and above.
%END REM
On Error Goto ErrorHandler
Dim session As New NotesSession
Dim dbSearch As NotesDatabase
Dim colEntries As NotesViewEntryCollection
Dim vwSearch As NotesView
Dim entryResult As NotesViewEntry
Dim docCurrent As NotesDocument
Dim docResult As NotesDocument
Dim strQuery As String
Dim strDb As String
Dim strView As String
Dim vwRestrictSearch As notesViewEntryCollection
' variables for single category search
Dim strRTC As String
Dim columnRTC As NotesViewColumn
Dim strRTCFormula As String
Dim intMax As Integer
Dim lngCount As Long, i As Long
Dim lngStart As Long, lngEnd As Long
Dim strParameters As String
Dim lngResults As Long
Dim tmpString As String
Dim x As Integer
Dim nbColDisplay As Integer
Dim nbColDisplayDefault As Integer
'start the xml document
Print "Content-Type:text/xml;"
Print "<?xml version=""1.0"" encoding=""iso-8859-1""?>"
'first we get the search parameters out of the querystring
'db, vw, query, searchmax, count, and start
Set docCurrent = session.DocumentContext
strParameters = docCurrent.GetItemValue("Query_String")(0)
strDb = GetParameter("db",strParameters)
strDb = Replace(Strright(strDb,"/"),"/","\")
strView = GetParameter("vw",strParameters)
strQuery = GetParameter("query",strParameters)
intMax = 0
If Isnumeric(GetParameter("searchmax",strParameters)) Then intMax = Cint(GetParameter("searchmax",strParameters))
lngCount = 100
If Isnumeric(GetParameter("count",strParameters)) Then lngCount = Clng(GetParameter("count",strParameters))
lngStart = 1
If Isnumeric(GetParameter("start",strParameters)) Then lngStart = Clng(GetParameter("start",strParameters))
'now we get the view to search
Set dbSearch = session.GetDatabase("",strDb,False)
Set vwSearch = dbSearch.GetView(strView)
If vwSearch.IsCategorized Then
' check for RestrictToCategory because if one exists, we have to adjust the columnnumber attribute
' and we will need to tweak the strQuery to also search on the category
strRTC = GetParameter("RestrictToCategory",strParameters)
' modification VDOC Formula ==> recr
erenault
12 Nov 2008, 2:19 AM
Bug if your view is no categorized and under certain conditions there is a problem on column with date (update in green) B)/:)
Sub Initialize
%REM
This agent can be called from the web to search any view and return results in the
same format as the ?ReadViewEntries command. This was created for use with the
NotesView2 class v1.3 and above.
%END REM
On Error Goto ErrorHandler
Dim session As New NotesSession
Dim dbSearch As NotesDatabase
Dim colEntries As NotesViewEntryCollection
Dim vwSearch As NotesView
Dim entryResult As NotesViewEntry
Dim docCurrent As NotesDocument
Dim docResult As NotesDocument
Dim strQuery As String
Dim strDb As String
Dim strView As String
Dim vwRestrictSearch As notesViewEntryCollection
' variables for single category search
Dim strRTC As String
Dim columnRTC As NotesViewColumn
Dim strRTCFormula As String
Dim intMax As Integer
Dim lngCount As Long, i As Long
Dim lngStart As Long, lngEnd As Long
Dim strParameters As String
Dim lngResults As Long
Dim tmpString As String
Dim x As Integer
Dim nbColDisplay As Integer
Dim nbColDisplayDefault As Integer
'start the xml document
Print "Content-Type:text/xml;"
Print "<?xml version=""1.0"" encoding=""iso-8859-1""?>"
'first we get the search parameters out of the querystring
'db, vw, query, searchmax, count, and start
Set docCurrent = session.DocumentContext
strParameters = docCurrent.GetItemValue("Query_String")(0)
strDb = GetParameter("db",strParameters)
strDb = Replace(Strright(strDb,"/"),"/","\")
strView = GetParameter("vw",strParameters)
strQuery = GetParameter("query",strParameters)
intMax = 0
If Isnumeric(GetParameter("searchmax",strParameters)) Then intMax = Cint(GetParameter("searchmax",strParameters))
lngCount = 100
If Isnumeric(GetParameter("count",strParameters)) Then lngCount = Clng(GetParameter("count",strParameters))
lngStart = 1
If Isnumeric(GetParameter("start",strParameters)) Then lngStart = Clng(GetParameter("start",strParameters))
'now we get the view to search
Set dbSearch = session.GetDatabase("",strDb,False)
Set vwSearch = dbSearch.GetView(strView)
strRTC = GetParameter("RestrictToCategory",strParameters)
If vwSearch.IsCategorized Then
' check for RestrictToCategory because if one exists, we have to adjust the columnnumber attribute
' and we will need to tweak the strQuery to also search on the category
'strRTC = GetParameter("RestrictToCategory",strParameters)
' create view
Set vwRestrictSearch = vwSearch.GetAllEntriesByKey(strRTC, True) 'exact match
'now we run the search on collection restrictTocategory
Call vwRestrictSearch.FTSearch(strQuery,intMax)
On Error Goto ErrorHandlerEntries
'now we spit out the results
Print "<viewentries toplevelentries=""" & Cstr(lngResults) & """>"
Set colEntries = vwRestrictSearch
lngResults = colEntries.Count
Else
'now we run the search
lngResults = vwSearch.FTSearch(strQuery,intMax)
On Error Goto ErrorHandlerEntries
'now we spit out the results
Print "<viewentries toplevelentries=""" & Cstr(lngResults) & """>"
Set colEntries = vwSearch.AllEntries
End If
'set the starting point for the loop
If lngStart > lngResults Then lngStart = lngResults
'set the ending point for the loop
lngEnd = lngStart + lngCount - 1
If lngEnd > lngResults Then lngEnd = lngResults
'now loop through the appropriate subset of results and print out a viewentry tag for each one
i = lngStart
While i <= lngEnd
Set entryResult = colEntries.GetNthEntry(i)
If Not entryResult Is Nothing Then
Set docResult = entryResult.Document
nbColDisplay = 0
Print "<viewentry position=""" & Cstr(i) & """ unid=""" & Cstr(docResult.universalID) & """ noteid=""" & Cstr(docResult.NoteID) & """ siblings=""" & Cstr(entryResult.SiblingCount) & """>"
x = 0
Forall value In entryResult.ColumnValues
If Not vwSearch.Columns(x).isCategory Then
If Not vwSearch.Columns(x).IsHidden Then
tmpString = ""
tmpString = tmpString + "<entrydata columnnumber=""" & Cstr(nbColDisplay) & """ name=""" & vwSearch.Columns(x).itemName & """>"
If Isdate(Cstr(value)) Then
Select Case vwSearch.Columns(x).TimeDateFmt
Case VC_FMT_DATE
tmpString = tmpString + "<text>" & XMLEscape(Cstr(Datevalue(Cstr(value)))) & "</text>"
Case VC_FMT_TIME
tmpString = tmpString + "<text>" & XMLEscape(Cstr(Timevalue(Cstr(value)))) & "</text>"
Case Else
tmpString = tmpString + "<text>" & XMLEscape(Cstr(value)) & "</text>"
End Select
else
tmpString = tmpString + "<text>" & XMLEscape(Cstr(value)) & "</text>"
end if
tmpString = tmpString + "</entrydata>"
Print tmpString
Else
nbColDisplay = nbColDisplay - 1
End If
Else
If (x > 1 And strRTC <>"") Or (strRTC = "") Then
tmpString = ""
tmpString = tmpString + "<entrydata columnnumber=""" & Cstr(nbColDisplay) & """ name=""" & vwSearch.Columns(x).itemName & """>"
If Isdate(Cstr(value)) Then
Select Case vwSearch.Columns(x).TimeDateFmt
Case VC_FMT_DATE
tmpString = tmpString + "<text>" & XMLEscape(Cstr(Datevalue(Cstr(value)))) & "</text>"
Case VC_FMT_TIME
tmpString = tmpString + "<text>" & XMLEscape(Cstr(Timevalue(Cstr(value)))) & "</text>"
Case Else
tmpString = tmpString + "<text>" & XMLEscape(Cstr(value)) & "</text>"
End Select
else
tmpString = tmpString + "<text>" & XMLEscape(Cstr(value)) & "</text>"
end if
tmpString = tmpString + "</entrydata>"
Print tmpString
Else
nbColDisplay = nbColDisplay - 1
End If
End If
x = x + 1
nbColDisplay = nbColDisplay + 1
End Forall
Print "</viewentry>"
End If
i = i + 1
Wend
AtEnd:
Print "</viewentries>"
Exit Sub
ErrorHandler:
Msgbox "<error>" & "Error in SearchView: " & Error & "---at " & Erl & "</error>"
Print "<error>" & "Error in SearchView: " & Error & "---at " & Erl & "</error>"
Exit Sub
ErrorHandlerEntries:
Msgbox "<error>" & "Error in SearchView: " & Error & "---at " & Erl & "</error>"
Print "<error>" & "Error in SearchView: " & Error & "---at " & Erl & "</error>"
Resume AtEnd
End Sub
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.