Cmdlets for XML

Build 24.0.9060

FlattenObjects Parameter (Connect-XML Cmdlet)

Set FlattenObjects to true to flatten object properties into columns of their own. Otherwise, objects nested in arrays are returned as strings of XML.

Syntax

Connect-XML -FlattenObjects bool

Data Type

bool

Default Value

true

Remarks

Set FlattenObjects to true to flatten object properties into columns of their own.

  • Object: Any parent element that does not repeat at the same height.
  • Array: Any element that repeats at the same height.
If this property is set to false, objects nested in arrays are returned as strings of XML.

For example, you can use this property to flatten the nested objects below at connection time:

<grades>
  <grade>A</grade>
  <score>2</score>
</grades>
<grades>
  <grade>A</grade>
  <score>6</score>
</grades>
<grades>
  <grade>A</grade>
  <score>10</score>
</grades>
<grades>
  <grade>A</grade>
  <score>9</score>
</grades>
<grades>
  <grade>B</grade>
  <score>14</score>
</grades>
To generate the column name, the cmdlet concatenates the property name onto the object name with a dot. When FlattenObjects is set to true and FlattenArrays is set to 1, the preceding array is flattened into the following table:

Column NameColumn Value
grades.0.gradeA
grades.0.score2

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 24.0.9060