Blazor WASM / Odata connection string
Posted: Fri Oct 11, 2024 8:55 am
We're using Blazor Reports Viewer and trying to view the records come from the backend using odata. I'm retrieving the Database and Odatasource but the dataTable is null even though theres record on it.
The report is showing a data when i'm testing on the designer but just on the viewer it shows empty. This is my current implementation:
<StiBlazorViewer Report="@Report" />
@code {
StiReport? Report;
bool isLoaded = false;
protected override async Task OnInitializedAsync()
{
// Load the report
var report = StiReport.CreateNewReport();
var bytes = await Http.GetByteArrayAsync("..../reports/TestReport.mrt");
report.Load(bytes);
// Configure the data source
var odataConnection = report.Dictionary.Databases["OData2"] as StiODataDatabase;
if (odataConnection != null)
{
var t = odataConnection.CanEditConnectionString;
odataConnection.ConnectionString = $"..../odata;Token={SessionState.Authentication.AccessToken}";
odataConnection.Synchronize(report);
}
Report = report;
StateHasChanged();
await base.OnInitializedAsync();
}
}
here is my testing .mrt file: Any help / suggestions would be greatly appreciated!
The report is showing a data when i'm testing on the designer but just on the viewer it shows empty. This is my current implementation:
<StiBlazorViewer Report="@Report" />
@code {
StiReport? Report;
bool isLoaded = false;
protected override async Task OnInitializedAsync()
{
// Load the report
var report = StiReport.CreateNewReport();
var bytes = await Http.GetByteArrayAsync("..../reports/TestReport.mrt");
report.Load(bytes);
// Configure the data source
var odataConnection = report.Dictionary.Databases["OData2"] as StiODataDatabase;
if (odataConnection != null)
{
var t = odataConnection.CanEditConnectionString;
odataConnection.ConnectionString = $"..../odata;Token={SessionState.Authentication.AccessToken}";
odataConnection.Synchronize(report);
}
Report = report;
StateHasChanged();
await base.OnInitializedAsync();
}
}
here is my testing .mrt file: Any help / suggestions would be greatly appreciated!