VoiceGuide IVR Software Main Page
Jump to content

Custom Variables In Vbscript.

Recommended Posts

Hi,

 

I'm trying to reset a module variable in a VBScript from a previous module but for some reason I can't.

 

See below:

-----

set vg = CreateObject("VoiceGuide.CommandLink")

set fso = CreateObject("Scripting.FileSystemObject")

 

'This is a translation table for the database

Select Case $RV[WhatDB]

Case 1 intSelectedDatabase = 9

Case 2 intSelectedDatabase = 1

Case 3 intSelectedDatabase = 3

Case 4 intSelectedDatabase = 4

Case 5 intSelectedDatabase = 2

Case 6 intSelectedDatabase = 7

Case 7 intSelectedDatabase = 8

Case 8 intSelectedDatabase = 6

Case Else intSelectedDatabase = 10

End Select

 

'The WhatDB module is 4 modules above this

vg.RvSet $RV_LINEID, "WhatDB", intSelectedDatabase

 

set vg = Nothing

---------

 

This doesn't work.

 

Are you allowed to call RvSet for a module that's not the module that you are in?

 

Also:

 

In the documentation for ResultVariables the result variable for VB Script is described as

Run VB Script Data returned by the VB Script.

 

 

I'm not sure what this means. I've tried using "vg.Run_ResultReturn $RV_LINEID, sResult" with sResult set to "BLAH-12345" but it doesn't seem to set the RV[Module] variable.

 

How do you specify what the VBScript is to return?

 

Am I just misunderstanding how this works?

 

I'm using version 5.2.3028

 

Let me know,

Thanks.

Share this post


Link to post
Are you allowed to call RvSet for a module that's not the module that you are in?
Yes.

 

The command:

 

vg.RvSet $RV_LINEID, "WhatDB", intSelectedDatabase

 

will set $RV[WhatDB] to the new value, so next time you use the $RV[WhatDB] in script it will hold the new value.

 

 

Could you please post a copy of VoiceGuide's Trace Logs which captures the problem you ar seeing, this will allow us to see what happened.

 

Enable logging by setting the log levels to 10 in VG.INI as per below:

[Log]

 

VoiceGuide=10

Then restart VG and make a test call which demonstrates the problem.

 

Trace files will be created in VG's \log\ subdirectory.

 

Please post the traces and the VoiceGuide script used.

 

When posting traces/scripts please .ZIP them up and post them as attachments.

 

 

 

I've tried using "vg.Run_ResultReturn $RV_LINEID, sResult" with sResult set to "BLAH-12345" but it doesn't seem to set the RV[Module] variable.
To return RV data using Run_ResultReturn the sResult should contain data in formal like this:

 

[MarketDow]{9,321}[MarketNasdaq]{1,702}[MarketSP500]{990}

 

Which means that $RV[MarketDow] = 9,321, $RV[MarketNasdaq] = 1,702, etc.

Share this post


Link to post

Okay, I tried to do the custom variable by setting [FullAcctNum] {BLAH-12345} and that didn't work.

 

I've attached the script and logs.

 

I'm working on a live system, so search thru the log files for "630457" as that was the account number that I was searching for. I then attempt to use this in a SQL query, but since the custom variable doesn't set, the query fails.

 

Let me know if you see anything.

logs.zip

Share this post


Link to post

Looking at your MepcoTest.vgs script we can see that you have the "Do Not Wait for Script to Complete" option selected for the VBScript module [buildAcctNum] ( which sets the $RV[FullAcctNum] ), so the next module [Run VB Script 1] starts before module [buildAcctNum] returns with the value for $RV[FullAcctNum].

 

Change the [buildAcctNum] option to be "Wait until VBScript Completes" and you should see it working properly.

 

You could also probably just combine the two VBScripts instead of calling two VBScript modules one after another.

 

 

 

Trace snippet below shows how right now module [Run VB Script 1] starts before [buildAcctNum] returns result.

 

 

131317.48 12 state [buildAcctNum] Running VB Script...

131317.48 12 rv replace start (strlen>500)

...

131317.48 12 eng run vbs [wscript "C:\Program Files\VoiceGuide\temp\vbs_12_2_0409131317.vbs" //I] copy of script in: vbs_12_2_0409131317.vbs

131317.51 12 VBScript Run continuing...

131317.51 12 timer clear

131317.51 12 state [Run VB Script 1] Running VB Script...

131317.51 12 rv replace start (strlen>500)

...

131317.51 12 eng run vbs [wscript "C:\Program Files\VoiceGuide\temp\vbs_12_3_0409131317.vbs" //I] copy of script in: vbs_12_3_0409131317.vbs

131317.54 12 Run Script waiting. iRunWait=1 (shellid=1952, process=1576)

131317.54 12 timer set 1 EV_TIMEOUT_CHECKONSTATE

131317.57 12 cl Run_ResultReturn >>[FullAcctNum]{DAR-630457}<<

131317.57 12 rv ns add [FullAcctNum]{DAR-630457}

Share this post


Link to post

If I use the "vg.Run_ResultReturn $RV_LINEID, strResultVariables"

then what do I have to specify in the path for the "Success" path?

 

usually i would use sResults = "success" and then the paths would know which module is next.

but strResultVariables being set to [blah]{Foo}, [blah2]{Foo2} then how does the script know what path to take next?

 

From the dropdown I can only choose 'success' 'failure' and 'timeout'

 

Let me know,

Thanks!

Share this post


Link to post
If I use the "vg.Run_ResultReturn $RV_LINEID, strResultVariables"

then what do I have to specify in the path for the "Success" path?

If some RV's are returned then the Success path will be taken.

 

As mentioned in Help file:

A "Success" or Result Variable list must be returned to VoiceGuide ... in order for it to go down the Success path.

 

You are already using this approach in your module [buildAcctNum] ...

 

As for the module [Run VB Script 1] it is right now returning either "verify_passed" or "verify_failed" so it looks like that part of code was used in a Get Numbers module. You can still however define paths verify_passed" and "verify_failed" in the VBScript module and those paths will then be taken.

 

As the above paragraph suggests, you can make up your own return values as well and then have paths which match those labels. But if you return a RV String then the Success path will be taken (if it exists).

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
×