Property not visible to subsequent handlers

I have a Comment table in my SQL database. I am trying to filter this table in my application to show only rows from the current reporting period. The current reporting period is exposed in a view.

On my Page Load event I get the current period from the relevant view in my database and set the thisPeriod property:

The data in the Current_period_vw looks like this:


I have a picker at the top of the page for users to select the CostCentre they are interested in. The Change events on the picker then set a bunch of properties that are used in the data grids on the page - mostly they are all being filtered to show the data from the selected CostCentreID only.

In the case of the Comments datagrid, I also want to filter by the Current reporting period. This field is present on the Comments table. My issue is that I can't get the filter parameter to use the ReportingPeriod from the thisPeriod property.

I have a thisReportingPeriod property that I have set to 12 for troubleshooting.

Here is the filter parameter on the getComments method:

Configured like this, it works - the data grid displays one row only (for the selected cost centre in the specified reporting period). However when I amend ${thisReportingPeriod} to use ${thisPeriod.ReportingPeriod}, as below, then no data displays.

The GET request looks like this:

dotnet: info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 GET http://localhost:5000/odata/BudgetTool/Comments?$filter=CostCentreID%20eq%204%20and%20ReportingPeriod%20eq%20undefined

So no reporting period is being passed into the GET request.

I originally set ${thisPeriod} as part of the Change event on the picker but moved it to page level to see if this would work, but it didn't.

I have a feeling that the issue is because ${thisPeriod.ReportingPeriod} is an array and I want to use the first value only (and there will only ever be a single value because of the way the view is defined} but I can't figure out how to specify this in Radzen.

Hi @kieran,

If ${thisPeriod.ReportingPeriod} is an array of objects you can use the first value like this:

Best Regards,

Hi @enchev,

Thanks for your reply - it set me on the right track to figuring it out.

I had to set the thisPeriod property to use the first values from the array. thisPeriod still has multiple fields, but each now has only one value:

Then set the thisReportingPeriod property to ${thisPeriod.ReportingPeriod}

I'm sure this could be done in one step but I'm just glad to have it working!

1 Like