UDTable using LoadData parameter it throws Error e is null

Product: PowerShell Universal
Version: 1.5.9

When using New-UDTable if I use the Data parameter the table shows up fine but if I change it to use LoadData it throws the Error e is null on the dashboard.

This code displays fine.

$Columns = @(
	New-UDTableColumn -Property 'BackupFileName' -Title 'File Name'
	New-UDTableColumn -Property 'FileSize' -Title 'Size/GB'
	New-UDTableColumn -Property 'FileDate' - -Title 'Date'
	New-UDTableColumn -Property 'RetentionYears' -Title 'Retention Years'
)

$SQL = "SELECT BackupFileName,FileSize,FileDate,RetentionYears FROM backupFile WHERE PendingDeletion = 1;"

$Data = Invoke-Sqlcmd -Query $sql -ServerInstance $DBServer -Username $SQLUsername -Password $SQLPassword -Database $DBName -EncryptConnection | ForEach-Object {
	if (($_.FIleSize).ToString() -eq "")
	{
		$fSize = 0;
	}
	else {
		$fsize = $_.FileSize
	}

	@{
		BackupFileName = $_.BackupFileName;
		FileSize = “{0:n2}”-f ($fSize/1gb);
		FileDate = ($_.FileDate).tostring(“MM-dd-yyyy”);
		RetentionYears = $_.RetentionYears
	}
}

New-UDTable -Title "Pending Deletion" -Columns $Columns -Data $Data

But if I change to using a dynamic table it doesn’t work.

$Columns = @(
	New-UDTableColumn -Property 'BackupFileName' -Title 'File Name'
	New-UDTableColumn -Property 'FileSize' -Title 'Size/GB'
	New-UDTableColumn -Property 'FileDate' - -Title 'Date'
	New-UDTableColumn -Property 'RetentionYears' -Title 'Retention Years'
)

New-UDTable -Title "Pending Deletion" -Columns $Columns -LoadData {
	$TableData = ConvertFrom-Json $Body

	$SQL = "SELECT BackupFileName,FileSize,FileDate,RetentionYears FROM backupFile WHERE PendingDeletion = 1;"

	$Data = Invoke-Sqlcmd -Query $sql -ServerInstance $DBServer -Username $SQLUsername -Password $SQLPassword -Database $DBName -EncryptConnection | ForEach-Object {
		if (($_.FIleSize).ToString() -eq "")
		{
			$fSize = 0;
		}
		else {
			$fsize = $_.FileSize
		}

		@{
			BackupFileName = $_.BackupFileName;
			FileSize = “{0:n2}”-f ($fSize/1gb);
			FileDate = ($_.FileDate).tostring(“MM-dd-yyyy”);
			RetentionYears = $_.RetentionYears
		}
	}

	$Data | Out-UDTableData -Page $TableData.page -TotalCount $Data.Count -Properties $TableData.Properties
}

Then I see this.
image

Thank you,
Jeremy

1 Like

looking into that will get back to you, thanks for the info

can you post the error you see in the browser console

This is what I can see. If you need more info let me know.

TypeError: e is null
    Zo utilities.js:17
    h baseTable.js:38
    React 2
    cs baseTable.js:38
    React 6
    unstable_runWithPriority scheduler.production.min.js:19
    React 5
    _ ud-page.jsx:70
react-dom.production.min.js:209:194
    React 9
    unstable_runWithPriority scheduler.production.min.js:19
    React 5
    _ ud-page.jsx:70

Thanks,
Jeremy

can you click on this it will open the file in the browser on the line with the error, then past it here please

I copied the few lines before also just for reference.

export function normalizedData(dataSource) {
  const newDataArray = [];
  const keys = Object.keys(dataSource[0]); <- Erroring Line 17

ok i push to github a fix for this and a couple more fixes for bugs a few minutes ago, it should be in the tonight build, i hope it fix this,

1 Like

Ok I will try it out tomorrow to see if that fixes it.

Thanks!

sound :ok_hand:

I don’t see a new nightly build available. It is still showing the 14th as the last build.

1 Like

I tested my code with the nightly and it worked as expected. Do you have any idea when this will make it into the production build?

Thank you for the assistance.

all those fixes will be in the upcoming release, glad it’s all working for you