Database lookup error, I think

Discussion in 'CRM / Helpdesk / App Integration' started by livn46, Jul 15, 2016.

Thread Status:
Not open for further replies.
  1. livn46

    Joined:
    Oct 24, 2014
    Messages:
    78
    Likes Received:
    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.
     

    Attached Files:

    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. edossantos

    edossantos Support Team
    Staff Member 3CX Support

    Joined:
    Jun 27, 2007
    Messages:
    1,083
    Likes Received:
    77
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. livn46

    Joined:
    Oct 24, 2014
    Messages:
    78
    Likes Received:
    1
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. livn46

    Joined:
    Oct 24, 2014
    Messages:
    78
    Likes Received:
    1
    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?
     

    Attached Files:

    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. edossantos

    edossantos Support Team
    Staff Member 3CX Support

    Joined:
    Jun 27, 2007
    Messages:
    1,083
    Likes Received:
    77
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. livn46

    Joined:
    Oct 24, 2014
    Messages:
    78
    Likes Received:
    1
    Thanks, I got my project running!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Thread Status:
Not open for further replies.