• Home
  • Forums
  • SBM
  • How do I disable or remove entries in a single selection field dropdown on the fly?

What are chaiscript scoping rules? Question

0
I'm not sure if this is a problem or intended behavior but I'm pretty sure it's intended behavior. Initially I was thinking that a "try" block was different. Is the fact that "arl2" doesn't exist outside of the "try" block considered "intended behavior" or "defect"?

In the example below, the variable "arl1" is declared outside of the "try" context. It exists both outside and inside the "try". The variable "arl2" is declared inside the "try". It doesn't exist outside of the "try", so the line after the "try" referencing "arl2" errors.



------------ cut here ------------

// arl1 is declaired outside the "try" context
// arl2 is declaired inside the "try" block. It doesn't exist outside of that block.
var arl1 = Variant();

try {
LogInfoMsg("######## try ########" );
arl1 = Ext.CreateAppRecordList(Ext.TableId("TS_USERS","database")) ; // arl1 is a: chai:Variant / VBScript VarType:9 (Automation object) / Object / AppRecordList
var arl2 = Ext.CreateAppRecordList(Ext.TableId("TS_CONTACTS","database")) ; // arl2 is a: chai:AppRecordList
// do stuff that might cause exception
} catch(e) {
Ext.LogErrorMsg("FAILED: ${e.what()}") ;
}

// arl1 is a: chai:Variant / VBScript VarType:9 (Automation object) / Object / AppRecordList
LogInfoMsg("######## after ######## : arl1=${arl1}" );
// causes error : "Can not find object: arl2"
LogInfoMsg("######## after ######## : arl2=${arl2}" );

------------ cut here ------------
Responses (0)
  • There are no replies here yet.
Your Reply

Recent Tweets