I have a form that allows a user to attach a document over the web using a file upload control.
The attachment is saved and then I am using an agent to pick up and display all of the data entered (like a search engine).
I have a three views set up, each are sorted differently. Each of these views have the 5th column value set to Attachment Names.
I have four search options, Date, Region, Topic and Keyword.
The Date and Keyword options use the AllTopics view. The Region option uses a ByRegion view and the Topic option uses a Topics view.
When I search by Region or Keyword, the attachment is picked up and displayed. When I search by Date or Topic, then the attachment is empty.
Even stranger…the Date and Keyword search use the same view, but only the keyword search returns the attachment!!!
Code:
Set db=session.currentdatabase
Set view = db.getView(sView)
If sSearchType = “” Then
Set doc = view.GetFirstDocument
sSeminarDate = doc.ColumnValues(0)
sMonth = doc.Month(0)
sDay = doc.Day(0)
sYear = doc.Year(0)
sHdg1 = sMonth & " " & sDay & ", " & sYear
Elseif sSearchType = “Date” Then
Set co = view.GetAllDocumentsByKey(sKey)
Set doc = co.GetFirstDocument
Elseif sSearchType = “Topic” Then
Set vc = view.GetAllEntriesByKey(sKey)
Set entry = vc.GetFirstEntry
Set doc = entry.Document
Elseif sSearchType = “Region” Then
Set view = db.getView(sView)
Set doc = view.GetFirstDocument
Else
Set view = db.getView(sView)
Set doc = view.GetFirstDocument
End If
.
.
sAttachment = doc.ColumnValues(5)
I posted this question yesterday and someone suggested using the getembeddedobject option, but I think I need to know the name of the attachment.
I need to find out the attachment name, which I then display in my agent for viewing:
sAttachURL = “/intranet/MicroSem.nsf/AllTopics/” & sID & “/$File/” & sAttachment & “?OpenElement”
I can’t understand why it is working in some cases and not others!
Any ideas or suggestions would be greatly appreciated. Sorry for the second post, but my original post was lacking the fact that it is partially working…
Thanks in advance.