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

Question

Question

Extremely slow form load time when using stored procedure

asked on July 25, 2019

Hello,

 

 I am using Forms 10.3.0.975.  I have a stored procedure that is set to run whenever the autofill button is clicked, however I can 100% replicate that if the stored procedure is in place, it causes the form initial load time to increase to more than 2 minutes.  Does forms run the configured stored procedures on load for some reason?

 

The procedure is attached below.  It uses dynamic sql to search a table for records.  This is done because they may check one of several options to search by and it didn't make sense to create separate stored procedures for every single search combination.  They will also be adding 4 additional criteria, so it becomes an exponential number of possible combinations.

ALTER PROCEDURE [dbo].[SearchOrdersByOrderNumberAndCustomerNumberAndDateTEST] 
	@custnum int = NULL,
	@ordernum int = NULL,
	@company nvarchar(16) = NULL,
	@orderstatus int = NULL,  
	@SearchStartDate datetime = NULL,
	@SearchEndDate datetime = NULL

AS

DECLARE @sSQL NVARCHAR(2000), @Where NVARCHAR(1000) = ''
SET @sSQL = 'SELECT custnum, PROGRESS_RECID_IDENT_, orderdate, ponum, ordernum, openorder FROM [LB_Progress2].[dbo].[orderhed] '

IF @orderstatus is not null and @orderstatus <> ''
SET @Where = @Where + 'AND openorder = @_orderstatus '

IF @company is not null and @company <> ''
SET @Where = @Where + 'AND company = @_company '

IF @custnum is not null
SET @Where = @Where + 'AND custnum = @_custnum '

IF @ordernum is not null and @ordernum <> ''
SET @Where = @Where + 'AND ordernum = @_ordernum '

SET @Where = @Where + 'AND custnum <> ''0'' '

SET @Where = @Where + 'order by orderdate '

IF LEN(@Where) > 0
SET @sSQL = @sSQL + 'WHERE ' + RIGHT(@Where, LEN(@Where)-3)
 
EXEC sp_executesql @sSQL,
N'@_custnum int, @_ordernum int, @_company nvarchar(16), @_orderstatus int, @_SearchStartDate datetime, @_SearchEndDate datetime',
@_SearchStartDate = @SearchStartDate, @_SearchEndDate = @SearchEndDate, @_orderstatus = @orderstatus, @_company = @company, @_custnum = @custnum, @_ordernum = @ordernum

0 0

Replies

replied on July 29, 2019

Hello,

I have had this problem recently, this could be down to a le fields from sql althoarge amount of data being returned and the page takes a while to render all of data although, this should not take quite 2 minutes! Does the stored procedure when run directly from SQL take anywhere near this amount of time? If not it could be possible that either something the lookup is returning may be pointing to additional lookups which is causing a lookup loop which will continue until it has looped through every returned row... which could easily take this amount of time. Or something within the javascript code is being looped on every change to the table... maybe formatting the table after every change for example.

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

Sign in to reply to this post.