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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScripting for Avaya

Status
Not open for further replies.

PRMiller

Technical User
Mar 18, 2004
95
US
Good evening,

I originally posted this message over in the Avaya/Definity forum, but realized it may belong here, instead. Avaya scripting uses SOME elements of VBScript, but not all - hence the problems! Here's what I'm facing:

I'm writing a script to run a report and export data from Avaya (CMS Supervisor v11.0). I copied an old, working script and inserted several new lines of code.

The new code starts with the DIM statements and ends with END SELECT. When I try to execute the script, I receive the following error in my log: "[Line: 4] Expected end of statement."

The purpose of the new code is to allow the end-user to run the same report any month, any year, without having to change the dates within the report.

The problem appears to be with the "Dim" statements. Does Avaya use a different syntax for defining variables? Is this the right method?

Here's the script (I removed the servername here for security purposes):



'LANGUAGE=ENU
'SERVERNAME=
Public Sub Main()

Dim MyMonth As Integer
Dim MyYear As Integer
Dim RunDate As String

MyMonth = Month(Date)
Myyear= Year(Date)


Select Case MyMonth
Case 1
RunDate = MyMonth & "/01/" & MyYear & "--1"
Case 2
RunDate = MyMonth & "/01/" & MyYear & "--1"
Case 3
RunDate = MyMonth & "/01/" & MyYear & "--1"
Case 4
RunDate = MyMonth & "/01/" & MyYear & "--1"
Case 5
RunDate = MyMonth & "/01/" & MyYear & "--1"
Case 6
RunDate = MyMonth & "/01/" & MyYear & "--1"
Case 7
RunDate = MyMonth & "/01/" & MyYear & "--1"
Case 8
RunDate = MyMonth & "/01/" & MyYear & "--1"
Case 9
RunDate = MyMonth & "/01/" & MyYear & "--1"
Case 10
RunDate = MyMonth & "/01/" & MyYear & "--1"
Case 11
RunDate = MyMonth & "/01/" & MyYear & "--1"
Case 12
RunDate = MyMonth & "/01/" & MyYear & "--1"
End Select

On Error Resume Next

cvsSrv.Reports.ACD = 4
Set Info = cvsSrv.Reports.Reports("Historical\CMS custom\Agt Gp Productivity")

If Info Is Nothing Then
If cvsSrv.Interactive Then
MsgBox "The report Historical\CMS custom\Agt Gp Productivity was not found on ACD 4.", vbCritical Or vbOKOnly, "Avaya CMS Supervisor"
Else
Set Log = CreateObject("AVSERR.cvsLog")
Log.AutoLogWrite "The report Historical\CMS custom\Agt Gp Productivity was not found on ACD 4."
Set Log = Nothing
End If
Else

b = cvsSrv.Reports.CreateReport(Info,Rep)
If b Then

Rep.Window.Top = 2865
Rep.Window.Left = 3405
Rep.Window.Width = 8565
Rep.Window.Height = 5790



Rep.SetProperty "Agent Group","CALL CENTER"

Rep.SetProperty "Dates","RunDate"




b = Rep.ExportData("S:\Common\CallCntr\Employee Performance Evaluator\Data\-1\AgtGrpProdDataMTD.txt", 59, 0, True, False, True)





Rep.Quit


If Not cvsSrv.Interactive Then cvsSrv.ActiveTasks.Remove Rep.TaskID
Set Rep = Nothing
End If

End If
Set Info = Nothing

End Sub


Thanks,
Paul
 
Try putting another 'End If' between the last end if an the set info = nothing statement, your missing one and its from the main original If statement.

eg.
Code:
[blue]End If[/blue]
[blue]End If[/blue] [green]'Insert this one[/green]
[blue]Set[/blue] Info = Nothing

[blue]End Sub[/blue]

-Niphyr

------------------------------
------------------------------
 
and just for future reference...
you can indent blocks to help trap these errors:

Code:
'LANGUAGE=ENU
'SERVERNAME=
Public Sub Main()
  Dim MyMonth As Integer
  Dim MyYear As Integer
  Dim RunDate As String

  MyMonth = Month(Date)
  Myyear= Year(Date)

  Select Case MyMonth
  Case 1
    RunDate = MyMonth & "/01/" & MyYear & "--1"
  Case 2
    RunDate = MyMonth & "/01/" & MyYear & "--1" 
  Case 3
    RunDate = MyMonth & "/01/" & MyYear & "--1"
  Case 4
    RunDate = MyMonth & "/01/" & MyYear & "--1"
  Case 5
    RunDate = MyMonth & "/01/" & MyYear & "--1"
  Case 6
    RunDate = MyMonth & "/01/" & MyYear & "--1"
  Case 7
    RunDate = MyMonth & "/01/" & MyYear & "--1"
  Case 8
    RunDate = MyMonth & "/01/" & MyYear & "--1"
  Case 9
    RunDate = MyMonth & "/01/" & MyYear & "--1"
  Case 10
    RunDate = MyMonth & "/01/" & MyYear & "--1"
  Case 11
    RunDate = MyMonth & "/01/" & MyYear & "--1"
  Case 12
    RunDate = MyMonth & "/01/" & MyYear & "--1"
  End Select

  On Error Resume Next

  cvsSrv.Reports.ACD = 4
  Set Info = cvsSrv.Reports.Reports("Historical\CMS custom\Agt Gp Productivity")

  If Info Is Nothing Then
    If cvsSrv.Interactive Then
      MsgBox "The report Historical\CMS custom\Agt Gp Productivity was not found on ACD 4.", vbCritical Or vbOKOnly, "Avaya CMS Supervisor"
    Else
      Set Log = CreateObject("AVSERR.cvsLog") 
      Log.AutoLogWrite "The report Historical\CMS custom\Agt Gp Productivity was not found on ACD 4."
      Set Log = Nothing
    End If
  Else
    b = cvsSrv.Reports.CreateReport(Info,Rep)
    If b Then
      Rep.Window.Top = 2865
      Rep.Window.Left = 3405
      Rep.Window.Width = 8565
      Rep.Window.Height = 5790 
      Rep.SetProperty "Agent Group","CALL CENTER"
      Rep.SetProperty "Dates","RunDate"
      b = Rep.ExportData("S:\Common\CallCntr\Employee Performance Evaluator\Data\-1\AgtGrpProdDataMTD.txt", 59, 0, True, False, True)
      Rep.Quit
      If Not cvsSrv.Interactive Then cvsSrv.ActiveTasks.Remove Rep.TaskID
      Set Rep = Nothing
    End If
  End If
  Set Info = Nothing
End Sub


It looks like you have all of the if blocks closed correctly...

another way to dim variables is...

Public and Private:

Public Var as ...

HOWEVER... this is VBScript

the only TYPES you have access to is Object and Variant

Try this instead...
Dim MyMonth As Variant
Dim MyYear As Variant
Dim RunDate As Variant
or
Dim MyMonth, MyYear, RunDate

that should take care of it, or just leave them out entirely...
You do not need to declare variables in vbScript, they are handled automatically.

see w3schools:

in particular

here is clip:
What is a Variable?

A variable is a "container" for information you want to store. A variable's value can change during the script. You can refer to a variable by name to see its value or to change its value. In VBScript, all variables are of type variant, that can store different types of data.

hope this helps

Good Luck,
-Josh S



also...

it looks like you select case conditions all turn out the same...

you might try this:

Select Case MyMonth
Case 1 to 12
RunDate = MyMonth & "/01/" & MyYear & "--1"
End Select


Have Fun, Be Young... Code BASIC
-Josh
cubee101.gif


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
Thanks Nypher and Josh. Our code actually was indented, but it pasted into the message funny, and I didn't have time to reformat it.

Josh, I didn't know VBScript didn't require variable declaration... that'll save some time in the future! Unfortunately, with the hybrid we appear to be working with, Avaya rejects any variables that aren't declared. It's a shame they couldn't stick with one language!

We're working on another module this morning, but we're going to try your suggestions this afternoon. I'll let you know how it works.

Thanks again for the replies!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top