Forums
Difference between setContext and Var? - Printable Version

+- Forums (https://bdn.bdb.ai)
+-- Forum: BDB Knowledge Base (https://bdn.bdb.ai/forumdisplay.php?fid=13)
+--- Forum: BDB Dashboards Designer (https://bdn.bdb.ai/forumdisplay.php?fid=43)
+---- Forum: BDB Designer Q & A (https://bdn.bdb.ai/forumdisplay.php?fid=16)
+---- Thread: Difference between setContext and Var? (/showthread.php?tid=383)



Difference between setContext and Var? - Abhiram.m - 12-22-2022

Both setContext and Var use to assign value to a variable. But if we are using Var, we can not use the Variable outside the particular scripting area(Component/Connection). At the same time, setContext can be used anywhere in the Dashboard.
 
Ie, if we are setting a context in Dashboard script, we can utilize the assigned value in any other component or connection scripting area using getContext.
 
Eg:
sdk.setContext( 'age_val', 1 );         --> In dashboard Script
var a = sdk.getContext( 'age_val' ); -->In component Script