OnExport issues

Product: PowerShell Universal
Version: 1.5.15

Hi.

We are using the server-side table processing and wants to make use of the new OnExport feature. But I can’t get it to work.

Only csv export creates files and the files only consists of the csv-separators. Problem can be recreated with the below mentioned dashboard.

I can’t find any errors in logs.

What am I doing wrong? Thank you :slight_smile:

New-UDDashboard -Title "Hello, World!" -Content {
    New-UDTable -Id 'Export' -LoadData {
        $TableData = ConvertFrom-Json $Body
        $Data = @(
            @{Dessert = 'Frozen yoghurt'; Calories = 159; 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 = 159; Fat = 6.0; Carbs = 24; Protein = 4.0 }
        ) 
        $Data | Out-UDTableData -Page $TableData.page -TotalCount $Data.Count -Properties $TableData.properties 
    
    } -Columns  @(
        New-UDTableColumn -Property Dessert -Title "A Dessert" -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
    ) -ShowPagination -ShowExport -OnExport {
        @(
            @{Dessert = 'Frozen yoghurt'; Calories = 159; 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 = 159; Fat = 6.0; Carbs = 24; Protein = 4.0 }
        ) 
    }
}

Content of csv file:

dessert,calories,fat,carbs,protein
,,,,
,,,,
,,,,
,,,,
,,,,

It looks like we have a bug where the properties need to be lower case.

This will work.

    New-UDTable -Id 'Export' -LoadData {
        $TableData = ConvertFrom-Json $Body
        $Data = @(
            @{Dessert = 'Frozen yoghurt'; Calories = 159; 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 = 159; Fat = 6.0; Carbs = 24; Protein = 4.0 }
        ) 
        $Data | Out-UDTableData -Page $TableData.page -TotalCount $Data.Count -Properties $TableData.properties 
    
    } -Columns  @(
        New-UDTableColumn -Property Dessert -Title "A Dessert" -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
    ) -ShowPagination -ShowExport -OnExport {
        
            @{dessert = 'Frozen yoghurt'; calories = 159; 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 = 159; fat = 6.0; carbs = 24; protein = 4.0 }
        
    }

I opened an issue here.

Thanks. Lowercases works. (I’m convinced I tried that, but apparently not good enough :laughing: )

I’ll open an issue for ‘Other than CSV doesn’t create files in Server-Side Exporting’