VoiceGuide IVR Software Main Page
Jump to content

How To Return Failfrom Runvbs Module

Recommended Posts

I have a simple questions as below (How do I return "FAIL" to the module here?). This code is in a VB script module.

 

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Dim dbConnn, objRS, objCmd, iRec, dbConn, iID, iTitle

 

set dbconn = createobject("ADODB.Connection")

dbConn.open "DSN=Infoline","wcochrane","crony123"

 

iID = $RV[Request Property ID] ' get ID from last module

 

msgbox "Setup Prop: " & iID

 

sql="SELECT num, title FROM prop WHERE num > " & iID & " ORDER by num"

 

set objRS = CreateObject("ADODB.RecordSet")

set objCmd = CreateObject("ADODB.Command")

 

objCmd.ActiveConnection = dbConn

objCmd.Commandtext = sql

objRS.Open objCmd

 

If objRS.bof and objRs.eof Then

How do I return "FAIL" to the module here?

Else

iID = objRS("num").value

iTitle = objRS("title").value

End if

 

objRS.close ' close dbase

 

iRec = "[PROPERTY_ID]{" & iID & "}" & "[PROPERTY_Desciption]{" & iTitle & "}" 'put it back together to write

iRet = WriteResultFile(iRec) 'write it back to the file

 

'*********************************************

Function GetPropID

 

Const ForReading=1, ForWriting=2, ForAppending=8

Dim filename, fso, ts, outdata, outdata2, outdata3, ID

 

filename = "C:\scripts\VGRUNRESULT_0.TXT.last"

set fso = CreateObject("Scripting.FileSystemObject")

set ts = fso.OpenTextFile(filename, ForReading, True)

ID = ts.ReadLine

ts.Close

 

GetPropID = ID

 

end function

 

'*********************************************

function WriteResultFile(strResult)

 

Const ForReading=1, ForWriting=2, ForAppending=8

Dim filename, fso, ts, outdata, outdata2, outdata3

 

filename = "c:\scripts\VGRUNRESULT_$RV_DEVICEID.TXT"

set fso = CreateObject("Scripting.FileSystemObject")

set ts = fso.OpenTextFile(filename, ForWriting, True)

ts.WriteLine(strResult)

ts.Close

 

WriteResultFile = 0

 

end function

Share this post


Link to post

You just need to write:

 

FAIL

 

to the result file, as per the old format - it can be used in the VGRUNRESULT_$RV_DEVICEID.TXT output files.

 

otherwise you could also write:

 

"[PROPERTY_ID]{9999}[PROPERTY_Desciption]{NotFound}

 

and in an 'Eval' module have a test to see if PROPERTY_Desciption = NotFound

Share this post


Link to post

Hello

 

I read this message but I don't understand how we can use an "eval module" to read variables in a text file.

How to use the [PROPERTY_ID]{xxx} and [PROPERTY_Desciption]{xxx}

 

Thanks

Share this post


Link to post

Just use the Result Variables:

 

$RV[PROPERTY_ID]

 

and

 

$RV[PROPERTY_Desciption]

 

in your script.

 

The data in file:

 

[PROPERTY_ID]{9999}[PROPERTY_Desciption]{NotFound}

 

is just used to define new Result Variables and their values...

 

 

PS. in VG v5.0 onwards you can use Run_ResultReturn COM function to return data to VG.

Share this post


Link to post

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×