Grid content in $session variable @()

Try to do something like this:

$myrow="" | select-object field0,field1,field2,field3,field4



New-UDGrid -ID ‘ABC’ -Title “ABC” -Headers @(“1”, “2”, “3”,“4”, “5”) -Properties @(“field0”, “field1”,“field2”,“field3”, “field4”) -Endpoint {
$session:mygridvar | Out-UDGridData

everything is working fine as Long as i do not use session context.
$mygridvar=@() -> works fine
$session:mygridvar=@() -> get error:

Exception calling “Invoke” with “0” argument(s): “Method invocation failed because [System.Management.Automation.PSObject] does not contain a method named ‘op_Addition’.”

But I Need session context to work with $mygridvar in other places …
Can someone please help me?

Hi @Fabian I have only used the $session variable once in a dashboard project. I have posted it in the show off section, but I uploaded a copy of it here:-

Hopefully this will help you out

I think I found a Workaround …

first work with $mygridvar and PSCustomObject instead of select-object.
(not in session context) At the end put the result into a $session:variable:

$mygridvar | Out-UDGridData

This seems to work … Just changing my source-code (lot of work …)

Hey @Fabian so glad you got the solution working…the nivo chart heatmap had me stumped for a longtime. Least you know how to work it now