JavaScript conversion has a problem with the Eval and Execute commands

I am using the latest version of AppStudio (9.3.1.7) and using Voltbuilder to build my app for Android. It appears that the Basic to JavaScript conversion program has a problem with the Eval() and Execute() functions. I am trying to replace a long Select Case (see below) with something more elegant.

'  Select Case TxnCode
'    Case "31" 
'      Process31Txn(TxnData)    
'    Case "32" 
'      Process32Txn(TxnData)    
'    Case "33" 
'      Process33Txn(TxnData)    
'    Case "34" 
'      Process34Txn(TxnData)    
... 

When I try the following, I get no errors when I build the app (in release mode) but the code will not execute properly.

Eval("Process" & TxnCode & "Txn(TxnData)") 

I believe that the Basic Code line get converted to JavaScript but it converts the “(“ and “)” to square brackets, so the line becomes:

eval(“Process” + TxnCode + “Txn[TxnData]”);

which is not what I want. BTW - When I highlight the Basic Code line in the AppStudio Editor and use the “View Javascript” fucntion, everythig looks fine.

When I do the following (by changing the way the parts are concatenated)

Eval("Process" & TxnCode & "Txn(" & "TxnData)")

or 

Eval("Process" & TxnCode & "Txn" & "(" & "TxnData" & ")")

it appears to work fine but the line of code looks odd. It took me a quite a while to debug this issue.
Please have a look and see if there is a fix so thers don’t run into the same issue. I know that I could use Javascript.. End Javascript statements but then I wouldn’t have found the issue with the Conversion utility.

Kindest Regaards,

It looks like it thinks TxnData is an array. Do you use it as an array anywhere?

If I start a new program with just eval(“Process” + TxnCode + “Txn(TxnData)”);, it translates properly.

You can go to a variable function name by using window[variable](paremeter)

window["Process" & TxnCode & "Txn”](TxnData)

Thank you for your suggestions. Yes, TxnData is an array. I am not sure what happened but when I build the app now, using Eval(“Process” & TxnCode & “Txn(TxnData)”), it seems to build correctly. I wish I had copied/saved the original Debugger code from when I first saw the issue.

BASIC uses round brackets for array references (as well as function calls), where JavaScript using square brackets for arrays. AppStudio keeps an internal list of variables that have been used as arrays, so it can apply the correct brackets when it converts to JavaScript.