UD-Table Export Not Working with IncludeInExport

Product: PowerShell Universal
Version: 1.4.6

Hi All,

Currently, I am working on a page that allows the user to make an export of the show monthly actions.
Loading the table provides no challenges, when Including the -Export option on the UD-Table, Exporting goes fine → results in an empty file.
When adding the -IncludeInExport parameter on the Columns to export them towards the file, nothing happens, no errors are shown as well, you can just click them and nothing happens… I already eliminated all the columns to see if it was a data-related issue (parsing, invalid type, etc.) but that doesn’t seem to be the case.
Below you see a screenshot of my code Using the parameter.


Using this parameter makes it impossible to export → also tried with name.

Removing this parameter makes it possible to do an export, nonetheless without this parameter on the columns this results in empty files.


Am I doing something wrong? Is there a workaround?

Thank you for your time and effort!

Kind regards.
Frederik

This is a problem with exporting and -Render. You can work around it by using a hidden column for the export purposes and a rendered column for the display purposes.

    $Data = @(
        @{Dessert = 'Frozen yoghurt'; Calories = 1; Fat = 6.0; Carbs = 24; Protein = 4.0}
        @{Dessert = 'Ice cream sandwich'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
        @{Dessert = 'Eclair'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
        @{Dessert = 'Cupcake'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
        @{Dessert = 'Gingerbread'; Calories = 200; Fat = 6.0; Carbs = 24; Protein = 4.0}
    ) 

    $Columns = @(
        New-UDTableColumn -Property ButtonDessert -Title Dessert -Render { 
            New-UDButton -Id "btn$($EventData.Dessert)" -Text "Click for Dessert!" -OnClick { Show-UDToast -Message $EventData.Dessert } 
        }
        New-UDTableColumn -Property Dessert -Title Dessert -Hidden -IncludeInExport
        New-UDTableColumn -Property Calories -Title Calories -IncludeInExport
        New-UDTableColumn -Property Fat -Title Fat -IncludeInExport
        New-UDTableColumn -Property Carbs -Title Carbs -IncludeInExport
        New-UDTableColumn -Property Protein -Title Protein -IncludeInExport
    )

    New-UDTable -Data $Data -Columns $Columns -Sort -Export
1 Like

Hi Adam

Thanks for the fast reply!

The workaround works! Only the Hidden parameter is not available to me, which is weird as I am using PU 3.X and according to the API it is from 2.X and upwards. Nonetheless using none rendered columns did the charm :slight_smile:

Once again, thank you.

kind regards.
Frederik