How to use the ExecutePS function in selfVM
(Adding message template to the top of the page)
No edit summary
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{message|Write the content here to display this box}}
<message>Write the content here to display this box</message>
==== NOTE: ExcutePS is replaced with selfVM.[[OCLOperators PSEval|PSEval]] - use that instead for new stuff ====
==== NOTE: ExecutePS is replaced with [[Documentation:OCLOperators PSEval|<Class>.PSEval]] - available in the context of every Class ====
This is a practical reference example of how to use the ExceutePS function from a ViewModel. There are many possible uses, but this one is fairly descriptive.  
This is a practical reference example of how to use the ExecutePS function from a ViewModel. There are many possible uses, but this one is fairly descriptive.  


'''Need:''' Look up all the objects with the same value as one particular object. Maybe the user wants to know if something is unique or not…  
'''Need:''' Look up all the objects with the same value as one particular object. Maybe the user wants to know if something is unique or not…  


The Model:
===== The Model: =====
[[File:Execute -1.png|none|frame|283x283px]]
[[File:Execute -1.png|none|frame|283x283px]]


The ViewModel:
===== The ViewModel: =====
[[File:Execute -2.png|none|frame|419x419px]]
[[File:Execute -2.png|none|frame|419x419px]]


Line 17: Line 17:
If you have a million Thing objects in the database, this ViewModel will only load the ones with the same attribute1 as the Thing object you started with.  
If you have a million Thing objects in the database, this ViewModel will only load the ones with the same attribute1 as the Thing object you started with.  


See: [[OCLOperators_ExecutePS]]
'''See:''' [[Documentation:OCLOperators ExecutePS|OCLOperators_ExecutePS]]
[[Category:OCLPS]]
[[Category:OCLPS]]
[[Category:View Model]]
[[Category:View Model]]
[[Category:OCL ViewModel Operators]]
[[Category:OCL ViewModel Operators]]
{{Edited|July|12|2024}}
{{Edited|July|12|2025}}

Latest revision as of 22:42, 12 March 2025

This page was created by Wikiadmin on 2018-10-30. Last edited by Charles@mdriven.net on 2025-03-12.

NOTE: ExecutePS is replaced with <Class>.PSEval - available in the context of every Class

This is a practical reference example of how to use the ExecutePS function from a ViewModel. There are many possible uses, but this one is fairly descriptive.

Need: Look up all the objects with the same value as one particular object. Maybe the user wants to know if something is unique or not…

The Model:
Execute -1.png
The ViewModel:
Execute -2.png

Set the vValueToMatch to the Attribute1 of the ViewModel root Thing. Then, call the ExecutePS, stating that it will get a result collection with the objects of type Thing if it runs the expression found in OutOfLoopToAvoidStdFetch.col1. Collect this result and add the objects to a list you added as a variable – vMyList.

The list can act as a root for Grid in the UI.

If you have a million Thing objects in the database, this ViewModel will only load the ones with the same attribute1 as the Thing object you started with.

See: OCLOperators_ExecutePS