1

I have a list(list 1- $itemModes) which contains following fields,

class Mode {
    [string]$WorkflowName
    [string]$WorkflowId
    [string]$ItemId
    [string]$ItemName
    [string]$InstallMode
    [string]$MergeMode
}
[Mode[]]$itemModes=@()

I have another list(list2- $items) as follows,

 $items |
        Show-ListView @props -Property @{Label="Name"; Expression={$_.DisplayName} },           
            @{Label="Workflow State"; Expression={(Get-Item -Path "master:" -ID $_."__Workflow state").Name} },
            @{ Name="Source"; Expression={}},
            @{ Name="InstallMode"; Expression={}},
            @{ Name="MergeMode"; Expression={}}

How do I update the InstallMode, MergeMode values from list 1 in list 2 I need to match the item Id and workflow name. How do I use where-object with in,

@{ Name="InstallMode"; Expression={}},
@{ Name="MergeMode"; Expression={}} 

Eg:

@{ Name="InstallMode"; Expression={$itemModes.InstallMode|Where-Object $_.Id -eq $itemModes.Id -and $_.WorkflowName -eq $itemModes.WorkflowName}},
@{ Name="MergeMode"; Expression={$itemModes.MergeMode|Where-Object $_.Id-eq $itemModes.Id -and $_.WorkflowName -eq $itemModes.WorkflowName}} 

I am not sure how to do this.

1 Answer 1

0

If you want to do this, then you need to first filter using the Where-Object and then call Show-ListView to show these filtered results. So I am showing a sample code here and then you need to adjust it wherever you want to use it.

# Getting the list of items 
$listOfPagesInTree = Get-ChildItem -Path "master:\content\home" -Recurse

# Filtering it using the Where-Object and then showing using Show-ListView
$listOfPagesInTree | Where-Object { $_.TemplateName -eq "Sample Item"} | Show-ListView      
       

Hope this will help you to complete your code.

Thanks

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.