ISQuestion.UploadFile

Description

This function uploads the selected file to the question.

Syntax

object.UploadFile aFileName, aSource

Part Attribute Type Description
object Required
The object always implements the ISQuestion interface
aFileName In, Required
string
The name of the file to be uploaded
aSource In, Required
The data stream that contains the body of the file being added

Example

Upload the selected file to the question and display some information about it.

Dim aPatient
Dim aQuestions, aQuestion
Dim aMessage
Dim i
Dim aStream
Dim aFileName

Set aPatient = Profile.SelectPatient   
set aQuestions = Profile.ProfileInternal.LoadQuestionsForPatient(aPatient.ID)
if aQuestions.Count = 0 then
  Profile.MsgBox("No questions")
  exit sub
end if  
set aQuestion = aQuestions.Item(0)
aMessage = aMessage & vbNewLine &_
  "Title: " & aQuestion.Title & vbNewLine &_
  "Amend Date: " & aQuestion.AmendDate & vbNewLine &_
  "Body: " & aQuestion.Body & vbNewLine &_
  "Date: " & aQuestion.Date & vbNewLine &_
  "Patient: " & aPatient.SurnameFirstName & vbNewLine &_
  "Status: " & aQuestion.Status & vbNewLine &_  
  "Uploaded Files Count = " & aQuestion.GetUploadedFileCount & vbNewLine  

set aStream = Profile.MakeStream
aFileName = "hello"
aStream.LoadFromFile("D:\documents\hello.docx")
aQuestion.UploadFile aFileName, aStream
aMessage = aMessage & vbNewLine & "The file '" & aFileName &_
  "' was successfully uploaded to the question '" & aQuestion.Title & "'" &_
  vbNewLine & vbNewLine & "Uploaded Files Count = " &_
  aQuestion.GetUploadedFileCount & vbNewLine
      
Profile.MsgBox(aMessage)
Note:

In Profile Client v8 on User Interface Uploaded Files can be found in Organisation > Work Centre > Work > Patient Items > Question Properties > Question > Uploaded Files.

See also

Version information

Added in v7.8.0