3

I am trying to define a function in which the dynamic parameters are dependent on each other. For example, I might have 1 parameter and two dynamic parameters:

  • $rootPath: The drive letter.
  • $rootPathItem: The first folder within the drive letter.
  • $rootPathChildItem: The second folder within the first.

The question is: how do I make it so that the ValidateSet for $rootPathChildItem is dependent on the other dynamic parameters? At its core, there doesn't seem to be a way to read the value of a dynamic parameter while inside the DynamicParam block (although in the begin block it is no problem). (Note, that this is just an example. I could change the initial parameter to be the months remaining in the year, for example.)

Ultimately, the question is how do I define dynamic parameters such that the second dynamic parameter is dependent on the selection of the items in the first dynamic parameter.

Help would be most appreciated.

Thanks in advance!

Mark

  • 3
    I get why `$rootPathChildItem` needs to be dynamic, but the other two? Can't they be regular parameters? What is the relationship between them? – Mathias R. Jessen Sep 04 '16 at 14:43
  • $rootPath: The drive letter. $rootPathItem: The first folder within the drive letter. $rootPathChildItem: The second folder within the first. While you are correct that $rootPathItem could be a regular parameter, this is just an example, not the real scenario. I could, for example, have the first item be the remaining dates in the month and I would have the same problem. Thanks, – Mark Michaelis Sep 05 '16 at 14:28
  • 1
    Please [edit](http://stackoverflow.com/posts/39317986/edit) these details into your question :) – Mathias R. Jessen Sep 05 '16 at 15:17

0 Answers0