VoiceGuide IVR Software Main Page
Jump to content

Vbs Module

Recommended Posts

How do I create an array with RvSet, just as the results returned by the database query module.($RV[ModuleTitle_ColumnIndex_RowIndex])

I have a VBS module with a query that returns multiple data. I want to build a type RVSet like $RV[Name_ColumnIndex_RowIndex)

Look at mi example:

 

 

set vg = CreateObject("vgServices.CommandLink")

set cn = CreateObject("ADODB.Connection")

set rs = CreateObject("ADODB.Recordset")

 

cn.Open "$RV[ConnStr]"

 

if cn.State <> 1 then

vg.Admin_TraceLogAdd iLineId, 5, "login LeadingAd connection to database could not be made"

vg.Run_ResultReturn iLineId, "fail"

WScript.Quit

end if

 

set rs.ActiveConnection = cn

sSQL = "SELECT CurrentBal, NumCard from TBLBalanceMast WHERE SocioNum = " & $RV[GetCustId]

rs.Open sSQL, cn, 3

 

if rs.RecordCount <= 0 then

rs.Close

vg.Admin_TraceLogAdd iLineId, 5, "no records retrieved"

else

Balance = rs.Fields("CurrentBal").Value

Number = rs.Fields("NumCard").Value

' vg.RvSet $RV_LINEID, "Balances",Balance

' vg.RvSet $RV_LINEID, "Numeros",Number

rs.Close

end if

 

cn.Close

set rs = Nothing

set cn = Nothing

set vg = Nothing

WScript.Quit

 

The query works fine, but do not know how I RvSet to assemble several variables indexed like database query module.

Thanks, Diego Bellini

Share this post


Link to post

change:

 

if rs.RecordCount <= 0 then
 rs.Close
 vg.Admin_TraceLogAdd iLineId, 5, "no records retrieved"
else
 Balance = rs.Fields("CurrentBal").Value
 Number = rs.Fields("NumCard").Value
 ' vg.RvSet $RV_LINEID, "Balances",Balance
 ' vg.RvSet $RV_LINEID, "Numeros",Number
 rs.Close
end if

 

to:

 

if rs.RecordCount <= 0 then
 rs.Close
 vg.Admin_TraceLogAdd iLineId, 5, "no records retrieved"
else
 recordcount = rs.RecordCount
 rs.MoveFirst 
 for i = 1 to recordcount 
   Balance = rs.Fields("CurrentBal").Value
   Number = rs.Fields("NumCard").Value
   vg.RvSet $RV_LINEID, "MyDatasetName_1_" & i, Balance
   vg.RvSet $RV_LINEID, "MyDatasetName_2_" & i", Number
   if i < recordcount then 
     rs.MoveNext 
   end if
 next
 rs.Close
end if

 

This way the RVs are created in the $RV[Name_ColumnIndex_RowIndex] format.

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
×