{"_id":"569eae952d320817003b809b","category":{"_id":"569ea93dffccd10d00a05c7f","__v":5,"version":"55fc9b793c21291900e7e0d7","pages":["569ea97fd233620d007055cc","569ea9bdc237d225002df5b6","569eae7e8f6d4b0d00f13b61","569eaed5c237d225002df5bd","569eaf04c237d225002df5bf"],"project":"5553d36165e8260d0024419a","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-01-19T21:23:09.676Z","from_sync":false,"order":11,"slug":"environment-variables","title":"Environment variables"},"project":"5553d36165e8260d0024419a","version":{"_id":"55fc9b793c21291900e7e0d7","__v":12,"project":"5553d36165e8260d0024419a","createdAt":"2015-09-18T23:17:13.545Z","releaseDate":"2015-09-18T23:17:13.545Z","categories":["55fc9b7a3c21291900e7e0d8","55fc9b7a3c21291900e7e0d9","55fc9b7a3c21291900e7e0da","55fc9b7a3c21291900e7e0db","55fc9b7a3c21291900e7e0dc","55fc9b7a3c21291900e7e0dd","55fc9b7a3c21291900e7e0de","55fc9b7a3c21291900e7e0df","55fc9b7a3c21291900e7e0e0","55fc9b7a3c21291900e7e0e1","55fc9b7a3c21291900e7e0e2","55fc9b7a3c21291900e7e0e3","55fc9bad4c80910d00b9bece","56394a0c3539050d00082122","56394a2f68b11f0d0048c9ff","56394a462fc5520d001a4db3","56394a4c2fc5520d001a4db4","56394a5b049e420d00476b5c","56394a6a2fc5520d001a4db5","56394f791593e4190073a44b","567b3adfb56bac0d0019d8d9","569d590e5a2b060d008741eb","569ea93dffccd10d00a05c7f"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"2.0.0","version":"2"},"__v":2,"parentDoc":null,"user":"5553d33065e8260d00244199","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-01-19T21:45:57.511Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":3,"body":"The text to be parsed can belong to an object that can be bound to a workspace.\nSuppose that we have the following structure\n_______________________________________________________________________\n**Object_1:\nworkspace = workspace_1\ntext = “Hi, my name is Davina. My email address is {{ email }}, my phone number is\n{{ phone }}, my Skype id is {{ skype}} and my var 4: {{ this.var_4 | $”VAR_NOT_FOUND” }}“\n\nObject_2:\nworkspace = workspace_2\ntext = “Hi, my name is Davina. My email address is {{ email }}, my phone number is\n{{ phone }}, my Skype id is {{ skype}} and my var 4: {{ this.var_4 | global.var_4 | $”VAR_NOT_FOUND” }}“**\n_______________________________________________________________________\n\nwhen parsing the above structure, the results should be\n_______________________________________________________________________\nObject_1:\ntext = “Hi, my name is Davina. My email address is davina:::at:::apimetrics.com, my phone number is\n+44-7123-456789 and my Skype id is davina@apimetrics.com and my var_4: VAR_NOT_FOUND”\n\nObject_2:\ntext = “Hi, my name is Davina. My email address is davina@apimetrics.com, my phone number is\n+44-7123-456789 and my Skype id is davina@apimetrics.com and my var_4 value_4”\n_______________________________________________________________________\nExplanation\n\n* **Object_1** is bound to **workspace_1**\n\n* * **Object_2** is bound to **workspace_2**\n\n* **Object 2** belongs to Object 1. Variables associated with Object 2 will be searched for\nin the following workspaces: **workspaces_2**, **workspace_1**, **global**.\n\nIf the workspace of variable is not defined, the parser will search first in **workspace_2**. If the\nvariable is not defined in **workspace_1**, it will search in **workspace_1**. If the variable is not defined in **workspace_1**, it will search in the global workspace.\n\n* **Object 1**: variables associated with **Object 2** will be searched for in the following workspaces: **workspace_1**, **global**.\n\nThis search order in workspaces defines the principle of workspace scopes.\n\nTo force the parser to search for a variable only in the current object workspace context, a special\nworkspace reserved name **this** is used in the form **this.***var*. \n\nWith this usage, the user can  define the search order as shown in the above example for **var_4**. **var_4** is not defined in **Object_2**. The alternative is **global**, and **var_4** is defined in **global**. **global** workspace **var_4** is returned. Because **var_4** is not defined in **Object_1**, the alternative is text **VAR_NOT_FOUND** is returned.\n\nImportant\nThe global workspace is always the last workspace to be searched in for a variable.","excerpt":"","slug":"workspace-scopes","type":"basic","title":"Workspace scopes"}
The text to be parsed can belong to an object that can be bound to a workspace. Suppose that we have the following structure _______________________________________________________________________ **Object_1: workspace = workspace_1 text = “Hi, my name is Davina. My email address is {{ email }}, my phone number is {{ phone }}, my Skype id is {{ skype}} and my var 4: {{ this.var_4 | $”VAR_NOT_FOUND” }}“ Object_2: workspace = workspace_2 text = “Hi, my name is Davina. My email address is {{ email }}, my phone number is {{ phone }}, my Skype id is {{ skype}} and my var 4: {{ this.var_4 | global.var_4 | $”VAR_NOT_FOUND” }}“** _______________________________________________________________________ when parsing the above structure, the results should be _______________________________________________________________________ Object_1: text = “Hi, my name is Davina. My email address is davina@apimetrics.com, my phone number is +44-7123-456789 and my Skype id is davina@apimetrics.com and my var_4: VAR_NOT_FOUND” Object_2: text = “Hi, my name is Davina. My email address is davina@apimetrics.com, my phone number is +44-7123-456789 and my Skype id is davina@apimetrics.com and my var_4 value_4” _______________________________________________________________________ Explanation * **Object_1** is bound to **workspace_1** * * **Object_2** is bound to **workspace_2** * **Object 2** belongs to Object 1. Variables associated with Object 2 will be searched for in the following workspaces: **workspaces_2**, **workspace_1**, **global**. If the workspace of variable is not defined, the parser will search first in **workspace_2**. If the variable is not defined in **workspace_1**, it will search in **workspace_1**. If the variable is not defined in **workspace_1**, it will search in the global workspace. * **Object 1**: variables associated with **Object 2** will be searched for in the following workspaces: **workspace_1**, **global**. This search order in workspaces defines the principle of workspace scopes. To force the parser to search for a variable only in the current object workspace context, a special workspace reserved name **this** is used in the form **this.***var*. With this usage, the user can define the search order as shown in the above example for **var_4**. **var_4** is not defined in **Object_2**. The alternative is **global**, and **var_4** is defined in **global**. **global** workspace **var_4** is returned. Because **var_4** is not defined in **Object_1**, the alternative is text **VAR_NOT_FOUND** is returned. Important The global workspace is always the last workspace to be searched in for a variable.