Using complex stored procedures with Radzen

Just passing on a workaround for those complex stored procedures that Radzen (specifically the Microsoft built in function ‘sys.dm exec describe first result set for object’) does not ‘Infer’ or allow you to add to your project. If the stored procedure is primarily for server side transaction processing and not to return dataset then a simple dummy select call will allow Radzen to ‘Infer’ the procedure and be added to your project for an ‘Invoke’. For example:

ALTER PROCEDURE [dbo].[usp_GetDeliveryDetails]
(
@deliveryNumber varchar(255),
@useExternalCosts bit,
@userName varchar(255),
@subDomain varchar(255)
)
AS

BEGIN TRY
SET NOCOUNT ON;

–************************************
– Set 1st result to dummy record
– for visibility in Radzen
–************************************
select * from dbo.Dummy

–************************************
– Check to see if user and delivery
– number exist if yes then select
– and exit
–************************************
IF EXISTS (select * from dbo.spReceiveOrder
where dbo.spReceiveOrder.loggedUser = @userName and
dbo.spReceiveOrder.DeliveryNo = @deliveryNumber)
BEGIN
RETURN 0;
END
EXEC usp_DeleteLinkedServers @subDomain
EXEC usp_CreateLinkedServers @subDomain

Without the dummy call the simple IF EXISTS was preventing the Microsoft function that Radzen uses for return value and parameters to identify the stored procedure.

3 Likes

Hi David,

I tried to use this advice. But when I added SELECT FROM DummyTable, I have 2 results from SP.
And my Radzen application return data from first one (dummy) and I don't know how to get data from second SELECT which I really need.

Can you help me?

Petr