Log in

View Full Version : using vb code with Avaya CMS 13 ,11 & 9



ltworf13
10-09-2007, 10:31 AM
I've succesfully coded cms 9 & 11 however I'm having trouble with 13. the code runs but there's no data. has anyone else had this problem with CMS 13.set info Is Nothing ,See bode below:


Option Compare Database
Function Get_AvayaIDP_bra()
'DoCmd.OpenForm "waiting", acNormal
'creat function
getLoginLogoutIDP3 "rwynter", "ltworf14", "Barmpton_HS", "xx.xx.xx.xx bra", _
"113", [Form_MainSwitchboard].Calfrom.Value,
DoCmd.Close acForm, "Waiting"
'MsgBox "done"
End Function


Sub getLoginLogoutIDP3(UserName As String, Password As String, _
Location As String, strServerIP As String, skill As String, _
strStartdate As String, strEnddate As String, PathName As String)

Dim fs As New Scripting.FileSystemObject

Dim ext_txt As String

Dim info As Object
Dim REP As Object
Dim b As Boolean
Dim cvsapp As New ACSUP.cvsApplication
Dim status As Boolean
Dim log As CVSERR.cvsLog
Dim cvsConn As Object
Dim cvsapp13 As New ACSUP.cvsApplication
Dim daterange As String
Dim intNoOfDays As Integer
Dim Counter As Integer
Dim incDate As Date
Dim freenum As Integer
Dim freetmpnum As Integer
Dim filename As String
Dim linestring As String
Dim tmp As String
Dim begindate As Date
Dim dateinc As Date
Dim enddate As Date
Dim j As Integer
Dim Header As String
Dim outfile As String


ext_txt = ".csv"


Header = """Location""," & """Skill""," & """Date""," & """startint""," & _
"""dummy"","
Header = Header & """endint""," & """ServiceLevel""," & _
"""ACDCallsWflowOut""," & """AvgSpeedAns"","
Header = Header & """AvgAbanTime""," & """ACDCalls ""," & """AvgACDTime"","
Header = Header & """AvgACWTime""," & """AbanCalls""," & """MaxDelay""," & _
"""FlowIn"","
Header = Header & """FlowOut""," & """ExtnOutCalls""," & """BAHT"","
Header = Header & """OtherTime""," & """acdTime""," & """AuxTime""," & _
"""AvgPosStaff""," & """Occupancy"""




'Debug.Print Header

'GoTo skip:



'Debug.Print strStartDate, strEndDate

begindate = CDate(strStartdate)
enddate = CDate(strEnddate)

tmp = PathName + Location + "IDPtmp" + skill + ext_txt
outfile = PathName + Location + "IDP" + skill + ext_txt
ExportCVFile = PathName + Location + "ExportCVIDP" + skill + ext_txt
dateinc = begindate
j = 0


Open tmp For Output As #2
Print #2, Header


Do


strdate = CStr(dateinc)


' Create a new CMS Application, Connection, Server, & Report
Set cvsapp13 = CreateObject("ACSUP.cvsApplication")
Set cvsConn = CreateObject("ACSCN.cvsConnection")
Set cvssrv = CreateObject("ACSUPSRV.cvsServer")
Set REP = CreateObject("ACSREP.cvsReport")

' Assign values to the instance of the cvsServer created above
status = cvsapp13.CreateServer(UserName, Password, "", strServerIP, False, _
"ENU", cvssrv, cvsConn)

'status = cvsapp.CreateServer(UserName, Password, "", strServerIP, False, "ENU",cvssrv)

If status = False Then
MsgBox "Your Username or Password is Invalid on Server" & strServerIP & _
vbCrLf & "Connection Aborted"
Exit Sub
End If




'Debug.Print status



'filename = PathName + Location + Skill + "_" + CStr(j) + ext_txt


'Debug.Print intNoOfDays

On Error Resume Next

cvssrv.Reports.ACD = 1


Set info = cvssrv.Reports.Reports( _
"Historical\CMS custom\Skill Summ by Intvl")


If info Is Nothing Then
If cvssrv.Interactive Then

MsgBox "The report Historical\CMS custom\SK Sum by Int Rev was not" & _
" found on ACD 1.", vbCritical Or vbOKOnly, "CentreVu Supervisor"
Exit Sub
Else
Set log = CreateObject("CVSERR.cvsLog")
log.AutoLogWrite "The report Historical\CMS custom\SK Sum by Int Rev" & _
"was not found on ACD 1."
Set log = Nothing
Close #2
Exit Sub
End If

Else
b = cvssrv.Reports.CreateReport(info, REP)

If b Then


REP.Window.Top = 2835
REP.Window.Left = 420
REP.Window.Width = 14580
REP.Window.Height = 5910



REP.SetProperty "Split/Skill", skill

REP.SetProperty "Date", strdate

REP.SetProperty "Times", "00:00-23:30"


b = REP.ExportData(ExportCVFile, 44, 0, True, True, True)




REP.Quit



If Not cvssrv.Interactive Then cvssrv.ActiveTasks.Remove REP.TaskID
Set REP = Nothing
End If


End If
Set info = Nothing

cvsConn.Logout
cvsConn.Disconnect

Set log = Nothing
Set cvssrv = Nothing
Set cvsConn = Nothing
Set cvsapp = Nothing


'Set fs = CreateObject("Scripting.FileSystemObject")
Open ExportCVFile For Input As #1
freetmpnum = FreeFile()


For i = 1 To 9
Line Input #1, linestring
Next

While Not EOF(1)
Line Input #1, linestring
outline = Location & "," & skill & "," & strdate & "," & linestring


'Print #2, linestring
Print #2, outline
Wend
Close #1



j = j + 1
dateinc = dateinc + 1

Loop Until dateinc > enddate

Close #2

fs.CopyFile tmp, outfile, True



Set fs = Nothing

'skip:
End Sub


EDIT: Added VBA tags for readability also added line breaks ~ Tommy

Banixxx
01-21-2008, 12:35 PM
LTWolf,

I dont know if this have been solved for you yet. I use this code and works well on all with minor Tweaks. First make sure in Tools, References, you have all needed Avaya Parts turned on like Application, Connection, Report and Server Components checked. Also i notice that the Applications names are differednt I had to use AVSUP before i could do the CSVApplication. Let me knwo if this works or if u have solved this already


Sub AvayaData()
'
' AvayaData Macro
' Macro recorded 1/20/2008 by ldorez
'
Dim cvsApp As New AVSUP.cvsApplication
Dim cvsConn As New cvsConnection
Dim cvsSrv As New cvsServer
Dim cvsCatalog As New cvsCatalog
Dim cvsRpt As New cvsReport
Dim avayaSheet As New Worksheet
Dim neededSheet As New Worksheet
Set avayaSheet = Sheets("Avaya")
Set neededSheet = Sheets("Needed")
Application.ScreenUpdating = False
If cvsApp.CreateServer("UNAME", "PASS", "", "SERVER", False, "ENU", cvsSrv, cvsConn) Then
If cvsConn.Login("UNAME", "PASS", "SERVER", "ENU") Then
End If
End If
Set cvsCatalog = cvsSrv.Reports
cvsSrv.Reports.ACD = 2
cvsCatalog.CreateReport cvsCatalog.Reports.Item("Real-Time\Agent\Agent Group Report"), cvsRpt
If cvsRpt.SetProperty("Agent Group", "All") Then
End If
cvsRpt.Run
cvsRpt.ExportData "", 9, 0, True, False, True
avayaSheet.Activate
Cells(2, 2).Select
ActiveCell.PasteSpecial (xlPasteAll)
neededSheet.Activate
StopReports:
cvsRpt.Quit
cvsSrv.Connected = False
Set cvsCatalog = Nothing
Set cvsRpt = Nothing
Set cvsSrv = Nothing
Set cvsApp = Nothing
Application.ScreenUpdating = False
'
End Sub

ltworf13
01-21-2008, 02:38 PM
Hi thank you for the reply. I'v got a work around at the moment. I still cannot get cms 11 & 13 to work via the above code. So what I'm doing is creating an autoscript from Avaya then having a BAT in code run the script

Banixxx
01-22-2008, 09:31 AM
Ltwork13,

I need to get a few bits of info then and ill see if we can find the problem. I have my code working for Avaya CMS Supervisor V11 just fine. I need to know what your running i assume the same as me plus v13.

Now when you open the macro go to TOOLS > REFRENCES
- Starting from the top go down one at a time until you hit the first refrences that is in the C:\Program Files\Ayava\***
I need to know the name of this if you have v11 it should be called "Application Component" is this correct? If so make sure its checked and then check the following

"Catalog Component"
"Connection Component"
"Report Component"
"Server Componment"

After this is done i want you to type this into a macro
- "Dim cvsApp as new "
Once you time that a drop down list should pull up. Now with v11 there should be one that says AVSUP if you see it select that. Once selected type this
- "."
Another menu should pop up but this time only 1 options "csvApplication"

If you can do that let me know. if not let me know what references are called and etc..