VoiceGuide IVR Software Main Page
Jump to content

Using Excel Cell Contents To Branch

Recommended Posts

Hi,

Sorry if this question is simplistic, but I can’t seem to find any examples or documentation on how to use a value looked up in a spreadsheet in an “evaluate expression” module.

 

Using example3 within “4.Moduals Reference/Run VB Script” of the VoiceGude Help file works great for getting the values from the spreadsheet into the variables value1 and value2, but how are these values then used in a subsequent Evaluate Expression module so the program can branch accordingly?

 

How do you correctly refer to them in the “Expression to Evaluate” box so that you can use paths to branch to subsequent modules depending on what the value in the spreadsheet cell is?

 

Perhaps I’m going about this the wrong way, but it doesn’t seem that a VBS script can directly initiate flow to a new module within the same script, or can it?

 

Thanks in advance,

Clarence

Share this post


Link to post
Using example3 within “4.Moduals Reference/Run VB Script” of the VoiceGuide Help file works great for getting the values from the spreadsheet into the variables value1 and value2, but how are these values then used in a subsequent Evaluate Expression module so the program can branch accordingly?

To return these values to VoiceGuide and create Result Variables which store these values you can use a VBScript snippet like this:

 

set vg = CreateObject("VoiceGuide.CommandLink")

vg.Run_ResultReturn $RV_LINEID, "[MyName1]{" & value1 & "}[MyName2]{" & value2 & "}"

Set vg = Nothing

 

And then you can use this information in VoiceGuide like this: $RV[MyName1] and $RV[MyName2]

 

How do you correctly refer to them in the “Expression to Evaluate” box so that you can use paths to branch to subsequent modules depending on what the value in the spreadsheet cell is?

 

In the Evaluate Expression module it's usually a good idea to use quotes around the RV you are trying to evaluate:

 

"$RV[MyName1]"

 

Perhaps I’m going about this the wrong way, but it doesn’t seem that a VBS script can directly initiate flow to a new module within the same script, or can it?
From VBScript you can jump to other modules directly using the commands Script_Goto and Script_Gosub.

Share this post


Link to post

Hi Again,

Thanks for your help. I was able to get it working somewhat.

 

As you didn’t specify where exactly to place the code snippet in the excel example, I’ve tried numerous things placing it in the VBS module before, after, and within the excel example. When used in a test script and inserting your lines in the example as following:

 

------------------------------------------------------------------------------

 

Dim xlApp, xlBook, xlSht

Dim filename, value1, value2, MyName1, MyName2

 

filename = "c:\Warehouse.xls"

 

 

Set xlApp = CreateObject("Excel.Application")

set xlBook = xlApp.WorkBooks.Open(filename)

set xlSht = xlApp.activesheet

set vg = CreateObject("VoiceGuide.CommandLink")

 

 

 

value1 = xlSht.Cells(2, 1)

value2 = xlSht.Cells(2, 2)

vg.Run_ResultReturn $RV_LINEID, "[MyName1]{" & value1 & "}[MyName2]{" & value2 & "}"

 

 

 

'the MsgBox line below would be commented out in a real application

'this is just here to show how it works...

'msgbox "Values are: " & value1 & ", " & value2

 

xlBook.Close False

xlApp.Quit

 

'always deallocate after use...

set xlSht = Nothing

Set xlBook = Nothing

Set xlApp = Nothing

Set vg = Nothing

 

------------------------------------------------------------------------

 

 

it works perfectly and just as expected. The data is placed and can be transferred to subsequent modules though “$RV[MyNumber1]” and “$RV[MyNumber2]” later on in the processing.

 

However, if I use the exact same code, mark for mark, as above in a similar “Run VB Script” module in another more elaborate script, (my real one) I can see that the VBS runs but VG hangs up the line before going to any other modules. I’ve tried countless different things but can’t get it to stop hanging up and can’t for the life of me determine why.

 

Would anyone know why this is happening?

 

Am I using the snippet in the wrong way or in the wrong place?

 

Thanks again.

 

 

 

 

0214vgm.txt

Share this post


Link to post

Could you please post the script and a copy of VoiceGuide's Trace Logs which captures the problem, 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.

 

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.

Share this post


Link to post

Found it!

 

After realizing in your request to turn on the trace that a lot more information for troubleshooting is in the log files when the trace is on, it was just then just a matter of comparing the logs for the working model against the non working one.

 

I realized that the error was that during testing I had left the bottom left hand box of the VBS module set to “Wait until VB Script and sound file completes” but had previously removed the sound file. This caused the VBS module to shut down and hang up, prematurely terminating further branching to subsequent modules.

 

Thanks for all your help, and Voice Guide as I’m finding, is a really good program. Also the support service you have going on here is also excellent.

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
×