Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7888805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:55:48+00:00 2026-06-03T05:55:48+00:00

is there a way how to expand / flatten row in datatable? I have

  • 0

is there a way how to expand / flatten row in datatable? I have data in variable $table which has 2 columns. In first columns there is stored [string] value, while in second column there is stored [string[]] array value, which contains at least 2 values. Here comes example of one such row:

DistinguishedName                       GroupNames
-----------------                       ----------
Applications/FarmName/Notepad           {Domain\Group1, Domain\Group2}

I’d like to have it flattened and exported to e.g. CSV format, while first column keeps “key value” DistinguishedName and all other columns are filled with particular value expanded from GroupNames column. Example of desired output follows:

Applications/FarmName/Notepad; Domain\Group1; Domain\Group2
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T05:55:49+00:00Added an answer on June 3, 2026 at 5:55 am

    If your intention is exporting to csv, possible solution might be creating own PSObject and dynamicaly populating it’s properties.

    Something like this:

    $expandedObjects = @()
    $table | % {
        #assuming $_ reffers to actual row
    
        $obj = new-object PSObject
        $obj | Add-Member -MemberType NoteProperty -Name "DistinguishedName" -Value $_.DistinguishedName
    
        $i = 0 # for dynamic property naming
        $_.GroupNames | % {
            # assuming $_ reffers to actual GroupName value
            $obj | Add-Member -MemberType NoteProperty -Name $("GroupName{0}" -f $i++) -Value $_
        }
        $expandedObjects += $obj
    }
    $expandedObjects | export-csv ..
    

    I didn’t test the code, so there might be some mistakes. Also I don’t know what type exactly your $table veriable is. But the idea should be clear.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to return a random row from a table using LINQToSQL?
Is there a way to get the C++ pre-processor to expand a #define'ed value
Is there way to set @include mixin(); to variable? I tried this @mixin bg-gradient($fallback,
Is there a way to expand one of the Project Explorer, Package Explorer, or
Is there a way to expand the Java memory-mapped byte buffer such that the
Is there a way to expand the !$ in command line while interactively editing
I have a jqgrid in a modal popup that has data dependent on some
expand.grid(i=rexp(5,rate=0.1)) It creates just one col but is there some way to multiply this
Is there any way to have multiple distinct HTML pages contained within a single
I'm using the latest MacVim. Is there any way to have it so if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.