You are viewing limited content. For full access, please sign in.

Question

Question

Stored Procedure Isn't Passing Values (and other issues)

asked on April 11, 2016 Show version history

Hi,

I'm trying to build a process to update a table based on input into a form, and then use that information later in the table.

Here's an outline:

Form:

Javascript:

$(document).ready(function() {
  
  var id = $.now();
  //alert(id);
  $('#q1 input').val(id);
  $('#q1 input').trigger('change');
  
  $('a#q7').click(function() {
    $('.groupsEntered input').on('change', function() {
      var group = $(this).val();
      $('#q3 input').val(group);
      $('#q3 input').trigger('change');
    });
  });

  $('.groupsEntered input').on('change', function() {
    var group = $(this).val();
    $('#q3 input').val(group);
    $('#q3 input').trigger('change');
  });

});

Stored Procedure:

ALTER PROCEDURE [dbo].[UserGroupGuid2] 
	-- Add the parameters for the stored procedure here
	@group varchar(50),
	@id bigint
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	
	INSERT INTO [ExternalTables].[dbo].[GroupAssignment] ([formid], [Group], [User])
	VALUES (@id, @group, 1)
		
END

Table:

Lookup Rules:

Issues:

  1. The stored procedure appears to only be running on the first "Change" Event in the 'groupinsert' field.
  2. The Stored Procedure is passing an empty value into the Group Column (varchar(50)).
  3. The Stored Procedure is passing a '0' instead of the $.now(); value from the 'formid' field.

Ideally I should type 'Test 1' into the 'groupinsert' field and the stored procedure should insert 'Test 1' into 'Group', '1' into 'User', and '%(formid)' into 'formid' in the SQL table.

Note that the '1' in 'User' is temporary.  I'm using it as a control so I can use javascript to click the autofill button and update the dropdown lists in the Users table.  The lookup in the Users table is working, so I left specific information about that lookup out of this outline.

Thanks in advance!

1 0

Replies

replied on April 12, 2016

What's the return of your stored procedure. There're multiple return type. Forms support the result sets type.

0 0
replied on April 12, 2016

This stored procedure doesn't have a return type.  It's only used for inserting data into a table.

0 0
replied on April 12, 2016 Show version history

Then it won't work. Forms is retrieving the output (result set) of the stored procedure.

0 0
replied on April 15, 2016

Then I'm curious, what is the intended purpose of the limited Stored Procedure functionality in Forms?

1 0
replied on April 15, 2016

Hi Eric,

This is not a feature limitation. It's the nature of Storedprocedure. Sp is very powerful, it can update multiple tables, insert multiple rows in the same sp. without an output, other applications won't be able to define what users want. So the result sets is what Microsoft put it place for the sp to output to the other systems.

Lookup needs to read from the return value, if the sp doesn't have output, lookup won't have the value. This is the same logic supported in Workflow.

0 0
replied on April 15, 2016

Is there a way to accomplish what I'm trying to do?  I just want to insert the values from "formid", "DDTrigger" and "groupinsert" into a table every time the "groupinsert" input value changes.

0 0
replied on April 15, 2016

Forms lookup is retrieving value from table, doesn't really designed to insert values to table. So i would suggest you use workflow service task to update the table after the form submission step.

0 0
replied on April 15, 2016

The only issue with that is that I'm trying to update this table in real time.  I plan to have javascript click the "AutoFill" that is tied to a lookup to this table (that I want to insert data into with the stored procedure).

 

The goal is to insert rows for the current formid, each containing a value from groupinsert using the stored procedure.  Then have these values be available in a lookup later in the same form (before submission, so workflow can't do this).

 

Would it be possible to do a Javascript web call (AJAX?) to the workflow web service to push this data?

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.