Naskeo Posted April 16, 2019 #1 Share Posted April 16, 2019 Hello all, I try to made a script who search number in database for rooting call. My script is: Function ChoixNumeroAstreinte() Dim Con, Rec, SQL, Value, NumeroSemaine 'Numéro de semaine NumeroSemaine= DatePart("ww",date) 'Création de la connexion Set Con = CreateObject("ADODB.Connection") 'Se connecte à la base de données Con.Open "DRIVER={MySQL ODBC 8.0 Unicode Driver};Server=xxxxxxx;Database=Astreinte;Uid=root;Password=xxxxx" 'Recherche du numéro d'astreinte dans la base de données Set Rec = Con.Execute("SELECT * FROM Numero WHERE Nom = 'Astreinte' and Semaine = '"& NumeroSemaine &"' ") 'Retour du numéro d'astreinte Value= Rec.Fields ("Numero").Value NumeroAstreinte = Value 'Ferme tout Rec.Close Set Rec=nothing Con.Close Set Con=nothing End function This script works on vbs but not in swyx. I put this script in Start Rule and the rule is like this Is someone can help me? Thanks Link to comment Share on other sites More sharing options...
Solution Tom Wellige Posted April 30, 2019 Solution #2 Share Posted April 30, 2019 Without having any server trace with the original error messages in it I would guess that the line NumeroAstreinte = Value is the problem. That variable is not defined within your function. Unless you haven't defined it as global variable in the Start block, it is not available/visible within the function. Unlike standard VBScript in Call Routing Script all variables MUST be defined. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now