Skip to main content

For a view I have a simple update handler, which naturally expects all the values of the view as parameters, as far as I know there is no way to change which variables are expected.

Here’s the generated code:

/* Create or alter stored procedure upd_preview_with_label. */

create or alter procedure "upd_preview_with_label"
(
@upd_preview_id preview_id, -- Key values of row to update

@preview_id preview_id,
@definition_id definition_id,
@production_run_id production_run_id,
@filepath filepath,
@printer_id printer_id,
@template_type template_type,
@width number,
@height number,
@print_buffer number,
@print_amount number,
@printer_assignment_name name,
@image_data_id image_data_id,
@image_format image_format,
@image_id uniqueidentifier,
@image_data varbinary(max),
@image_name image_name
)
as
begin

-- Do not count affected rows for performance
SET NOCOUNT ON;

begin try
begin transaction;

--control_proc_id: handler_update_preview_with_label
--template_id: handler_update_preview_with_label
--prog_object_item_id: handler_update_preview_with_label
--template_description:

-- update preview based on changes in preview_with_label. image gets updated separately
update preview set
printer_id = @printer_id,
template_type = @template_type,
print_amount = @print_amount
where preview_id = @upd_preview_id; -- Key values of row to update

commit transaction;
end try
begin catch

if @@trancount > 0
begin
rollback transaction;
end;

; -- Throw original exception
throw;
end catch;

end
go

grant execute on "upd_preview_with_label" to public
go

When updating the table, I get this error:

The following query failed with an exception: 'upd_preview_with_label' -->Procedure or function 'upd_preview_with_label' expects parameter '@image_id', which was not supplied.

As far as I can tell, there is nothing I can do to change which variables are passed to the stored procedure. This is all handled in the background, and expected to work.

My guess is that the type “uniqueidentifier” is causing the issue. The whole reason I have to have a view for this object in the first place, is that the “uniqueidentifier” column value has to be unique always, even if it is not the primary key, making it impossible to have the same value in more than one row. The “uniqueidentifier” type has to be used to be able to preview files, so I assume others might have run into this problem in the past. Any ideas on how to deal with this?

Hi,

In 🚀 Platform improvements for week 37 ⚠️ | Thinkwise Community, we mentioned a hotfix for this exact situation. ROWGUID datatype columns should not be added to the handler definition, thus we had to update the Software Factory for that.

Can you download from TCP for your platform version and run the hotfixes? After that, generate the definition and source code, or regenerate the control procedure to have the updated code.


Thanks ​@Mark Jongeling, works great! Very quick ;)

Was this issue only introduced recently, or is it a coincidence that I ran into it 3 days after the fix was released?


I believe it is a coincidence indeed. Indicium enforced this already for quite a while.


Reply