• V20: 3CX Re-engineered. Get V20 for increased security, better call management, a new admin console and Windows softphone. Learn More.

Database lookup error, I think

Status
Not open for further replies.

livn46

Joined
Oct 24, 2014
Messages
75
Reaction score
1
Hi all,

I'm working on my first VAD project. We have several conference rooms, and management is worried about people being able to make expensive outside calls from those public spaces without knowing who did it. We would like to have a dialer that prompts them to enter an extension and the extension's PIN, check to make sure that they're valid, and then prompt the user for the number they want to call and dial the number.

I think I have all this set up, but I'm hitting an error of some sort, I think with the database lookup.

I am attaching pictures of the process. The UserLogin component prompts first for the Extension and then for the PIN, and both of those get input correctly (I can see the variables change when I step through a Debug call), but then as soon as it hits the ValidateData component the call dies. When I go through the Debug log one step at a time it goes through each step of the UserLogin component, and then when it jumps over to the ValidateData component, it jumps to the Error Handler Flow screen, which I presume means it's hitting some error. The "CurrentErrorName" variables changes to "error.semantic.ecmascript". Does this mean that my database lookup is wrong? Do I have the right setup for it to do an ODBC connection to the Postgres database?

Thanks.
 

Attachments

  • vadproject_userlogin.png
    vadproject_userlogin.png
    38.9 KB · Views: 1,690
  • vadproject_validate_data.png
    vadproject_validate_data.png
    16.2 KB · Views: 1,690
  • vadproject_odbc.png
    vadproject_odbc.png
    9.3 KB · Views: 1,692
  • vadproject_databaseaccess.png
    vadproject_databaseaccess.png
    11.4 KB · Views: 1,690
Hi there!

The "error.semantic.ecmascript" is a javascript error. Maybe you made a typo while writing a variable name, or errors like that. In order to understand what's going on, I would suggest that you read this document:
http://www.3cx.com/blog/docs/troublesho ... lications/

When the app has an ecmascript error, you will see the details in the file "%ProgramData%\3CX\Data\Logs\3CXIvrServer.log" or "%ProgramData%\3CX\Data\Logs\3CXIvrServer.trace.log". If you're not sure about it, please send us the file and we'll point to the error.

Kind regards.
 
Thank you very much: knowing which log file to look in was mostly what I needed. I may come back if I get hung up on anything additional, but this gives me enough to move forward.
 
Okay, I got a few steps further and I'm getting the appropriate response from the database, but now I think I must be using the VAD Variable Assignment structure wrong.

In the screenshot below, I have a database lookup that looks up the dn.value of the extension that the user has typed in. As you can see in the debug screen here, the query has returned '187', which is correct. I then want it to assign the query result to variable "i" so that I can use it in the next step to look up the extension.fkiddn (and then I will use that to look up the voicemail.pinnumber that corresponds to that). However, clicking Next hits an error, variable i never gets assigned, and the error I see in "CurrentErrorName$" is "error.badfetch". What is this telling me?
 

Attachments

  • vad_project_dbresult.png
    vad_project_dbresult.png
    32.1 KB · Views: 1,155
  • vadproject_varassign.png
    vadproject_varassign.png
    3 KB · Views: 1,155
Hi there,

As you can see in the debug window, the returned value is not just the value 187, but it's a table having a single row and a single column: ['187']

In that case, maybe it's better to change the query type to Scalar, and get the value from the property ScalarResult.

But in case you need to get a value from a QueryResult table, you need to use the VAD functions "GET_TABLE_ROW_COUNT" and "GET_TABLE_CELL_VALUE" to get the values from that table:
- This will return the quantity of rows returned by the query: GET_TABLE_ROW_COUNT(db3CX1.QueryResult)
- And to get the value in a specific row and column, you use: GET_TABLE_CELL_VALUE(db3CX1.QueryResult, zero_based_row_index, zero_based_col_index)

Hope the information helps.

Kind regards.
 
Thanks, I got my project running!
 
Status
Not open for further replies.

Getting Started - Admin

Latest Posts

Forum statistics

Threads
141,625
Messages
748,896
Members
144,739
Latest member
Ghisl1
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.