Can't figure out how to process all topics within a nested folder structure

Hi,

The requirement I have is to process the latest released version of a certain language layer in a nested folder structure where there are many versions and each version has many language layers.

I have the following 

$metadataFilter = Set-IshMetadataFilterField -Level Lng -Name DOC-LANGUAGE -FilterOperator IN -Value 'en-US' |
                             Set-IshMetadataFilterField -Level Lng -Name FSTATUS -FilterOperator Equal -Value 'Released'

$ishObjects = Get-IshFolder -FolderPath $ishFolder -FolderTypeFilter @("ISHModule") -Recurse |
Foreach-Object {
  # find the latestreleased topics for each version
  $ishVersionObjects = Get-IshFolderContent -IshFolder $PSItem -MetadataFilter $metadataFilter -VersionFilter latestreleased |
  Get-IshDocumentObj | Out-File -Append "piped_topics.txt"
}

This works and I have a text file of all the topics with the latest released version for the en-US layer.

However, I want to process each of these topics to capture the version number and value from other metadata.

What is the best approach to edit what I have so I can both pipe to file for logging and also interrogate the topics returned to capture specific details from them to use for other processing?

Any advice appreciated,

Regards,

Ann 

emoji
Parents
  • Hi Ann,

    My end-of-day below answer would probably get you going how to keep your text/csv file updated but still continue processing

    $metadataFilter = Set-IshMetadataFilterField -Level Lng -Name DOC-LANGUAGE -FilterOperator IN -Value 'en' |
                                 Set-IshMetadataFilterField -Level Lng -Name FSTATUS -FilterOperator Equal -Value 'Released'
    
    $ishObjects = Get-IshFolder -FolderPath $ishFolder -FolderTypeFilter @("ISHModule") -Recurse |
    Foreach-Object {
      # find the latestreleased topics for each version
      $ishVersionObjects = Get-IshFolderContent -IshFolder $PSItem -MetadataFilter $metadataFilter -VersionFilter latestreleased |
      Get-IshDocumentObj
      # at this point variable $ishVersionObjects contains the Latest-Released-Version with FSTATUS=Released and DOC-LANGUAGE=en-US
      # let us append these found entries to the file, in my variation I made it a CSV file, a bit more structure and nicer to process in Excel later
      $ishVersionObjects | Export-Csv -Append "piped_topics.txt"
      Foreach ($ishVersionObject in $ishVersionObjects) {
        # do something per entry found here
        Write-Host ("Found LogicalId["+$ishVersionObject.IshRef+"] Version["+$ishVersionObject.version_version_value+"] Lang["+$ishVersionObject.doclanguage+"] Author["+$ishVersionObject.fauthor+"]")
      }
    }

    emoji
Reply
  • Hi Ann,

    My end-of-day below answer would probably get you going how to keep your text/csv file updated but still continue processing

    $metadataFilter = Set-IshMetadataFilterField -Level Lng -Name DOC-LANGUAGE -FilterOperator IN -Value 'en' |
                                 Set-IshMetadataFilterField -Level Lng -Name FSTATUS -FilterOperator Equal -Value 'Released'
    
    $ishObjects = Get-IshFolder -FolderPath $ishFolder -FolderTypeFilter @("ISHModule") -Recurse |
    Foreach-Object {
      # find the latestreleased topics for each version
      $ishVersionObjects = Get-IshFolderContent -IshFolder $PSItem -MetadataFilter $metadataFilter -VersionFilter latestreleased |
      Get-IshDocumentObj
      # at this point variable $ishVersionObjects contains the Latest-Released-Version with FSTATUS=Released and DOC-LANGUAGE=en-US
      # let us append these found entries to the file, in my variation I made it a CSV file, a bit more structure and nicer to process in Excel later
      $ishVersionObjects | Export-Csv -Append "piped_topics.txt"
      Foreach ($ishVersionObject in $ishVersionObjects) {
        # do something per entry found here
        Write-Host ("Found LogicalId["+$ishVersionObject.IshRef+"] Version["+$ishVersionObject.version_version_value+"] Lang["+$ishVersionObject.doclanguage+"] Author["+$ishVersionObject.fauthor+"]")
      }
    }

    emoji
Children
No Data