How to use the ExecutePS function in selfVM

This article was moved to MDriven Wiki How to use the ExecutePS function in selfVM

This is a practical reference example on how to use the ExceutePS function from a viewmodel. There are many possible uses but this is one that is fairly descriptive I think.

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





So what happens is that we set the vValueToMatch to the Attribute1 of the viewmodel root Thing. Then we call the ExecutePS, stating that it will get a result collection with objects of type Thing if it runs the expression found in OutOfLoopToAvoidStdFetch.col1. We collect over this result and add the objects to a list we added as a variable – vMyList.

That list can act as root for Grid in the UI.

If we have a million Thing-objects in the database – this viewmodel will only load the ones with the same attribute1 as the the Thing object we started with.

This entry was posted in ViewModel and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.