ViewModel variables
(Created page with "Something soon...")
 
No edit summary
Line 1: Line 1:
Something soon...
All of you models have predefined variables that help you interact with the view models  and its data. Depending on what you're using your View model for, you use different variables and different  variables are available.  The most commonly used are V current and V selected and V self-VM.  V current and V selected are used when you're having a cursored view model.  Please read more about cursored and uncursored view models in a separate article. You can turn off the V current and V selected variables by setting a tag value that you  can read about here.  The use for V current and V selected is that you can at runtime see which item in a list that has been clicked upon by the user. Or in the case of if it is turned on that they can select multiple items in a list, then  those objects that has been selected will be available in the collection called V selected  underscore and the name of the view model clause.  In this example we will have one V current that is not going to change because this is  a rooted view model and V current view one thing points to one thing object.  It will be the same as self.  Remember that the V current points to the view model clause object that is active regardless  of in which view model you are referencing that variable.  In contrast self is dependent on where the expression is placed.  If it is an expression in for example the blue detail view model clause in this example it will be a detail object. Because this is an expression here the action column on the root green view model clause  self references the root of the whole view.  If I make view model actions they very often use V current or V selected.  Not the list of things or the specific object that action should act upon.  You also have self VM.  Self VM references the running view model itself and it is used within action language  expressions to execute things or to find out the state of the view itself.  For example to execute an action to execute something in persistent storage that is SQL  to execute the query plan again to find out which objects have been changed in the view and to examine or execute things related to access groups or security.  You can also define your own variables for any use that you want for example to keep  a reference to an object that the user is working on.  You also note that if you don't use placing hints that is you don't have a user interface  that you use this view model for an API or a report.  The available variables changes.  For example variables are not for V current and V selected is not used in reporting.  However in an API scenario V current and V selected are sometimes used in special circumstances  to process their JSON or XML being imported but most of the times they are not used. There are also variables defined in specific action cases for example if you have a  model dialog that is an action that opens another view and then to access its result you  get specially named variables that are available in the action that executes after the model  has been closed.  You can always see which variables are available by for example opening the OCL editor for  attribute or as in this example the action editor for an in view action and then exploring in the action editor which methods and variables are available on the right hand side as in  this example.

Revision as of 06:29, 10 August 2023

All of you models have predefined variables that help you interact with the view models  and its data. Depending on what you're using your View model for, you use different variables and different  variables are available.  The most commonly used are V current and V selected and V self-VM.  V current and V selected are used when you're having a cursored view model.  Please read more about cursored and uncursored view models in a separate article. You can turn off the V current and V selected variables by setting a tag value that you  can read about here.  The use for V current and V selected is that you can at runtime see which item in a list that has been clicked upon by the user. Or in the case of if it is turned on that they can select multiple items in a list, then  those objects that has been selected will be available in the collection called V selected  underscore and the name of the view model clause.  In this example we will have one V current that is not going to change because this is  a rooted view model and V current view one thing points to one thing object.  It will be the same as self.  Remember that the V current points to the view model clause object that is active regardless  of in which view model you are referencing that variable.  In contrast self is dependent on where the expression is placed.  If it is an expression in for example the blue detail view model clause in this example it will be a detail object. Because this is an expression here the action column on the root green view model clause  self references the root of the whole view.  If I make view model actions they very often use V current or V selected.  Not the list of things or the specific object that action should act upon.  You also have self VM.  Self VM references the running view model itself and it is used within action language  expressions to execute things or to find out the state of the view itself.  For example to execute an action to execute something in persistent storage that is SQL  to execute the query plan again to find out which objects have been changed in the view and to examine or execute things related to access groups or security.  You can also define your own variables for any use that you want for example to keep  a reference to an object that the user is working on.  You also note that if you don't use placing hints that is you don't have a user interface  that you use this view model for an API or a report.  The available variables changes.  For example variables are not for V current and V selected is not used in reporting.  However in an API scenario V current and V selected are sometimes used in special circumstances  to process their JSON or XML being imported but most of the times they are not used. There are also variables defined in specific action cases for example if you have a  model dialog that is an action that opens another view and then to access its result you  get specially named variables that are available in the action that executes after the model  has been closed.  You can always see which variables are available by for example opening the OCL editor for  attribute or as in this example the action editor for an in view action and then exploring in the action editor which methods and variables are available on the right hand side as in  this example.

This page was edited 55 days ago on 03/20/2024. What links here