Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
 

In a previous article we covered the Function Builder. As of PowerShell Studio 2014 (v4.1.64), we improved parameter set support in the Function Builder.

Improved Function Builder

As you can see, we altered the ordering of the fields to improve the over-all work flow of the tool.

Notice the question marks? If you hover or click on a question mark, a help message will popup explaining the respective field.

inline help

Parameter Sets

The Parameter Set field has been expanded to include an Output Type. Now you can specify an optional output type for each parameter set you define.

Specify an output type for each parameter

When a parameter set is defined, the Function Builder reacts accordingly. For example, the Parameter Set Filter is enabled and a Parameter Set column is added to the Parameters list.

Before a Parameter Set is defined After a Parameter Set is defined
(Before a Parameter Set is defined) (After a Parameter Set is defined)

 

Parameters

The biggest change to the Function Builder is the parameters section. The columns have been reordered to create a better flow when defining parameters.

The Parameter Set column has been changed from a single selection combo box, to a text field where multiple parameter sets can be defined. You can simply type in the name of the parameter set you wish to assign to the parameter:

 define multiple parameter sets

You can also define a new parameter set within this field:

Define new parameter sets

Or assign multiple parameter sets to a single parameter by using a comma separator.

assign multiple parameter sets to a parameter

The Pos column is an optional field where you can quickly define the parameter’s position attribute. By default, the parameter’s position is determined by the ordering of the parameters.

 define the parameter's position attribute

For parameters that are assigned to multiple parameter sets, you can define each position by using a comma separator. The position values should follow the same ordering as the parameter set assignments.

Of course, you can also assign the parameter’s position and parameter sets using the parameter’s editor dialog by clicking the edit button:

editor dialog

The Parameter Dialog’s Parameter Set section to allows you to assign multiple parameter sets:

Parameter Dialog's Parameter Set section

Note that each parameter set has its own respective settings:

each parameter set has its own settings

Parameter Set Filter

The Parameters section also includes a Parameter Set Filter.

Parameter Set Filter

The Parameter Set Filter allows you to either show all the parameters, only show the parameters that are not assigned to a parameter set, or only show parameters within a specific parameter set. Selecting a filter other than “Show All” allows you to work within that specific parameter set.

all parameters; unassigned parameters; parameters within a specific parameter set

While in this mode, you can use the up and down menu buttons to move or swap the parameter positions.

For your convenience, the position field only shows the parameter’s position within the selected parameter set and does not list the other parameter set positions when a filter is applied.

Parameter Set Filter: Parameter set position

By default (Show All filter) the up and down move button only changes the order in which the parameters are declared in the function.

Note: In the Show All mode, the Mandatory check box refers to the parameter’s first assigned parameter set. 

 

When a parameter set is declared, the generated function will now include a switch statement to help you differentiate between the parameter sets:

    switch ($PsCmdlet.ParameterSetName)
    {
        'Name Set' {
            #TODO: Place script here
            break
        }
        'Data Set' {
            #TODO: Place script here
            break
        }
    }

 

We hope that this will increase your work-flow and make the creation of advanced functions with multiple parameter sets easier then ever.

If you have questions about our products, please post in our support forum.
For licensed customers, use the forum associated with your product in our Product Support Forums for Registered Customers.
For users of trial versions, please post in our Former and Future Customers - Questions forum.
Copyright © 2024 SAPIEN Technologies, Inc.