SupportTeam Report post Posted 01/30/2003 11:22 AM 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
SupportTeam Report post Posted 01/30/2003 11:22 AM 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
Guest Nicolas Report post Posted 04/15/2003 08:10 AM 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
SupportTeam Report post Posted 04/15/2003 10:14 PM 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