Saving Binaries (Ink, Images and Uploads) to SQL
Example database scripts and Infiniti form.
Binaries sourced from Ink or File Upload Questions can be saved to SQL just like the response to a text box or multiple choice question.
Binaries are sent to SQL as a base64 string usually destined for an NVARCHAR(MAX) column, as described in the example below.
The following script creates a table with columns for the response to a text question, an ink question and file upload
CREATE TABLE [dbo].[InfinitiBinary](
[Id] [int] IDENTITY(1,1) NOT NULL,
[TextQuestion] NVARCHAR(255),
[InkQuestion] NVARCHAR(MAX) NULL,
[UploadQuestion] NVARCHAR(MAX) NULL,
)
GO
To facilitate the insert the following stored procedure will receive all the values as strings.
CREATE PROCEDURE [dbo].[spInsertInfinitiBinary]
@TextQuestion NVARCHAR(255),
@InkQuestion NVARCHAR(MAX),
@UploadQuestion NVARCHAR(MAX)
AS
BEGIN
SET NOCOUNT ON;
INSERT INTO [dbo].[InfinitiBinary]
([TextQuestion]
,[InkQuestion]
,[UploadQuestion])
VALUES
(@TextQuestion
,@InkQuestion
,@UploadQuestion)
END
GO
With the database prepared, we can now create an Infiniti Form with the appropriate questions and add a Save to SQL action. Map the stored procedure parameters to the ink and file upload questions.
The project can now be run in Produce and the response to the Ink Question and Image Upload will be pushed to the SQL database
Updated almost 7 years ago