Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OLE properties,functions help

Status
Not open for further replies.

tom3x

Programmer
Jul 25, 2008
3
SK
I have following problem. When i access to external property or function like this:

OleObject oStudiesInfoList
oStudiesInfoList = Create OleObject
oStudiesInfoList.setautomationpointer(oStudyMngmt.FindStdy)

var1=string(oStudiesInfoList.Count)


I get error: Error calling external property Count

alike:

OleObject oStudiesInfo
oStudiesInfo = Create OleObject
oStudiesInfo.setautomationpointer(oStudiesInfoList)

oStudiesInfoList.Item(1)

Error calling external object function Item

I have power builder 7 and i have application pacsclnt.exe which has linked library (as resource) that i use.

Can you help me please? Thanks
 
Off the top of my head, I'm not sure what those OLEObjects actually are, but could the Count be a function, rather than property?

You might try using Count( ) [as a function] rather than Count [as a property]. There's also a chance that the object you're referencing is zero-indexed, and if it only has one item it would be Item(0) rather than Item(1).

Keep us posted...
 
Expression: oStudiesInfoList.Count() gets error

error calling external function Count

Extract from programmer's guide:
Objects in SDK and their functions and properties are defined in type library.Type library is linked in pacsclnt.exe as a resource. SDK can use in every prog. languages which support OLE automation.

Example in VBscript:


Option Explicit

Dim bOK
Dim oPACS
Dim oStudiesManagement
Dim oStudiesInfoList
Dim oStudiesInfo
Dim oStudiesSeqID
Dim msg

' Create TomoCon PACS client object
Set oPACS = CreateObject("PACSClient.App")

' Set connection parameters
oPACS.PACSHostName = "pacs"
oPACS.PACSPortNumber = 104
oPACS.UserName = "PacsUser"
oPACS.UserPassword = "Password"

' Get studies management object
Set oStudiesManagement = oPACS.StudyManagement

' Find new studies
Set oStudiesInfoList = oStudiesManagement.GetNewStudiesInfo

msg = "Found " & oStudiesInfoList.Count & " new studies"
If oStudiesInfoList.Count > 0 Then
msg = msg & vbCRLF & "SeqID = " & oStudiesInfoList.SeqID
End If
MsgBox msg

' Display found study infos
Dim I
For I = 0 To oStudiesInfoList.Count-1

Dim sPatientName
Dim sPatientID
Dim sPatientSex
Dim sPatientBirthDate

Set oStudiesInfo = oStudiesInfoList.Item(I)

bOK = oStudiesInfo.GetPatientName(sPatientName)
bOK = oStudiesInfo.GetPatientID(sPatientID)
bOK = oStudiesInfo.GetPatientSex(sPatientSex)
bOK = oStudiesInfo.GetPatientBirthDate(sPatientBirthDate)


msg = "Study " & I+1 & " of " & oStudiesInfoList.Count & vbCRLF & _
vbCRLF & _
"Patient's name: " & sPatientName & vbCRLF & _
"Patient's birth date: " & sPatientBirthDate & vbCRLF & _
"Patient's sex: " & sPatientSex & vbCRLF & _

MsgBox msg
Next

If oStudiesInfoList.Count > 0 Then
Dim ret
ret = MsgBox("Delete new studies info?", vbYesNoCancel)
If ret = vbYes Then
oStudiesManagement.DeleteNewStudiesInfo(oStudiesInfoList.SeqID)
End If
End If


and my code in PB


Integer li_rc
String ls_pacshostname,ls_pacsportnumber,ls_pacsusername,ls_pacsuserpassword

ls_PacsHostName=f_fromdb_settings_sys ('PACS', 'PacsHostName', '')
ls_PacsPortNumber=f_fromdb_settings_sys ('PACS', 'PacsPortNumber', '')
ls_PacsUserName=f_fromdb_settings_sys ('PACS', 'PacsUserName', '')
ls_PacsUserPassword=f_fromdb_settings_sys ('PACS', 'PacsUserPassword', '')

OleObject oPACS
oPACS = Create OleObject
li_rc = oPACS.ConnectToNewObject ("PACSClient.App")
IF li_rc < 0 THEN
DESTROY oPACS
MessageBox("Connecting to COM Object Failed", &
"Error: " + String(li_rc))
Return
END IF

oPACS.PACSHostName=ls_PacsHostName
oPACS.PACSPortNumber=ls_PacsPortNumber
oPACS.UserName=ls_PacsUserName
oPACS.UserPassword=ls_PacsUserPassword

OleObject oStudiesManagement
oStudiesManagement = Create OleObject
oStudiesManagement.setautomationpointer(oPACS.StudyManagement)

OleObject oStudiesFilter
oStudiesFilter = Create OleObject
oStudiesFilter.setautomationpointer(oStudiesManagement.NewStudyFindFilter)

oStudiesFilter.SetPatientID(gch_rod_cis)

OleObject oStudiesInfoList
oStudiesInfoList = Create OleObject
oStudiesInfoList.setautomationpointer(oStudiesManagement.FindStudy(oStudiesFilter))
ls_pacsportnumber=string(oStudiesInfoList.Count) //error never mind .Count or .Count()

Messagebox('',ls_pacsportnumber)

OleObject oStudiesInfo
oStudiesInfo = Create OleObject
oStudiesInfo.setautomationpointer(oStudiesInfoList)


To wit I dont know it's possible to do it in PB7 but programmer's guide writes exactly 'SDK can use in every prog. languages which support OLE automation.' so it would be...

Thanks for help.
 
As I have no experience with this object, I'm just throwing ideas out there...

Could you possibly try something like:
oStudiesInfoList = oStudiesManagement.FindStudy(oStudiesFilter)

...Rather than:

oStudiesInfoList.setautomationpointer(oStudiesManagement.FindStudy(oStudiesFilter))

I'm not exactly sure what the SetAutomationPointer() function does, but if I'm thinking correctly, it's basically assigning the next object variable. The method I listed should throw an error if you're not assigning a valid type.
 
Thank you very much for ambition.
oStudiesInfoList = oStudiesManagement.FindStudy(oStudiesFilter) not works but i will inform you when I correct the problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top