Missing Invoke Data source for view - GetById

Hello,
I need to create list and detail based on MSSQL view.
List works fine but I cannot find my getViewById for detail page.

I checked generated C# code and there is generated two actions for view, first for IEnumerable and then SingleResult. This looks fine.
But I cannot find this method getViewById in list of actions in dialog "Invoke data source method" in dropdown with action for Load page.

I tested this for MSSQL table and it works fine.

Thank you for suggestion

Hi @koblamic,

Views do not have primary key and that's why you cannot get a record by id.

I know, that primary key applies to table. But how can i get single row of this view.
Actually entity framework generated this code but i cannot access it from radzen gui:

[HttpGet("{OrderID}")]
public SingleResult GetVwProductionOrderPrint(int key)
{
var items = this.context.VwProductionOrderPrints.AsNoTracking().Where(i=>i.OrderID == key);
this.OnVwProductionOrderPrintsGet(ref items);
return SingleResult.Create(items);
}

This code is generated by Radzen not by EF. Thanks for pointing it - will be removed in the next update.

But how can I get single record of view?

Dear Radzen team,
it is possible to retrieve single line of SQL view?
I need to have List and Detail page based on SQL Views.
I have no other options then to use SQL views, because iยดm working with several databases provided with different vendors. I cannot have one "Radzen friendly" model.

Thank you

You can create a stored procedure to get the row that match your criteria.

Or you can look for it using Javascript:

objIndex = ${Array.findIndex((v => v.ColumnName == 'Value'))}

and then invoke the method of the view but set the result property to only that index:

viewResults = ${result.value[objIndex]}

1 Like

Thank you, that was my assumption to do.
I bit struggled with syntax finally used View with filter and then ${result.value[0]}.

Thank you