I have a basic simplelist form with a query as its data source, which includes two data tables with a common relation. My goal is to filter the grid using the bound controller WeekDays. Initially, it filters the records as expected. However, when I reload the form for the second time and try to filter, it throws an error: /Cannot create a record in RouteData (RouteData). The record already exists. I am puzzled as to why the selectionChange() function is not working as expected. Kindly review my code and provide insights.
RoutMaster routMaster;
{
super();
// routMaster = element.args().record();
// Day.selection(WeekDays::Sunday);
}
{
queryBuildDataSource = this.query().dataSourceTable(tablenum(RoutMaster));
queryBuildDataSource.clearRanges();
queryBuildDataSource.addRange(fieldnum(RoutMaster, WeekDays)).value(queryValue(RoutMaster_1_WeekDays.selection()));
super();
if(RoutMaster_1_WeekDays.selection())
{
qrWeek.value(int2str(RoutMaster_1_WeekDays.selection()));
}
else
{
qrWeek.value(SysQuery::valueUnlimited());
}
super();*/
{
int ret;
return ret;
}