UDGrid Refresh / IIS

Hello all ,

I have question about the dashboard refresh,
I run dashboard on IIS , and i think i have a miss-understanding about the dashboard refresh.

For exemple with this grid :

$SQLwithdata = Invoke-Sqlcmd -query “USE $SQLDatabase SELECT * FROM Donnees” -ServerInstance $SQLInstance

New-UDGrid -PageSize 30 -Title "data tab " -Headers @("ID","Name","Région", "IP", "State","Action") -Properties @("ID","Name","Région", "IP", "State","Action")  -Endpoint {

$tabgestionpf=@()
    $listepftab=@()
    $listepf=@()

      $SQLconnection | % {

      #Création Tableau de Port
      $listepftab = New-Object PSObject
      $listepftab | Add-Member -MemberType NoteProperty -Name 'ID' -Value $_.Id
      $listepftab | Add-Member -MemberType NoteProperty -Name 'Name' -Value $_.Nom
      $listepftab | Add-Member -MemberType NoteProperty -Name 'Région' -Value $_.Region
      $listepftab | Add-Member -MemberType NoteProperty -Name 'IP' -Value $_.IP_Reseau
      $listepftab | Add-Member -MemberType NoteProperty -Name 'State' -Value $_.state
      
                                               
      $listepf+=$listepftab }
      $listepf | Out-UDGridData}

The grid work good on the dashboard , but , if i make change on the data base ( call by $SQLwithdata ) , the grid refresh not work , i have to restart the dashboard to have the information refreshed.

I use the sql connection on other dashboard page and have the same issue , no refreshing data without dashboard restarting.

thanks for your help

Matthieu

You can use -AutoRefresh and -RefreshInterval in UDGrid in order to update the grid periodically

Thanks or your answer but i have already try and it’s not working :confused:

Is the update occurring in the background (database)?
If this is the case you have to query the new data $SQLwithdata in the Endpoint ScriptBlock

okey , that what i’m testing :confused:

$Schedule = New-UDEndpointSchedule -Every 20 -Second

$sqldatas = New-UDEndpoint -Schedule $Schedule -Endpoint {
    $Cache:$SQLwithdata = Invoke-Sqlcmd -query "USE databasename SELECT * FROM Donnees"  -ServerInstance "server"
} 

Start-UDDashboard -Port 10001 -wait -AutoReload -Dashboard $MyDashboard -AdminMode -Certificate $cert -Endpoint $sqldatas

Need i to use the variable $Cache:$SQLwithdata or $SQLwithdata on new_udgrid ?

Matthieu

It is not $Cache:$SQLwithdata it is Cache:SQLwithdata (without the before the SQLwithdata)
You have to use $Cache:SQLwithdata also in the UDGrid Endpoint ScriptBlock :slight_smile:

Nice it’s work , can i call the refresh myself by powershell command , for exemple after an action ?

Thanks

Sure:

  1. define -Id property on the UDGrid with some string (e.g. “data_grid”)
  2. Use Sync-UDEndoint -ID “data_grid”
1 Like