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

Question

Question

Can a SQL Lookup be controlled as to when it runs?

asked on August 14, 2024

I have a SQL View that runs and due to its complexity, it takes longer to lookup and load all the data into a table.  To add to that, there is an alternate version of that View that also runs at the same time but populates a separate table.

 

Currently, a user selects which table content they want to view with a radio button.  But we still wait for BOTH tables to load.  

Is there a way to only execute (1) lookup when a user selects, lets say a radio button option?

For example:  There is a need to populate a form using a view, with every employee who will be retiring in 1 year.  Then there is a very similar View to lookup every employee who will be retiring in 2 years.

 

It would be nice if my lookups could be dynamic in the sense of altering the 1 year value vs 2, but I think that is beyond the ability of me and Forms.

 

So, is it possible to only execute (1) lookup based on the user selection?

Or would the use of Stored Procedures be a better option for the situation?

 

Thank you for any insights.

0 0

Answer

SELECTED ANSWER
replied on August 14, 2024

You want to use a stored procedure for this and just have the number of years be the parameter that triggers.  

0 0

Replies

replied on August 14, 2024

It would be interesting to gauge the performance of your form on the new form designer as it handles large tables significantly faster than classic forms.

In any case, you could try using the autofill button if your lookup table has more than one input and use that to populate the form.

 

I'm not sure if the stored procedure option would handle how you currently have your form setup. If you have two form tables you would need two lookups.

0 0
replied on August 14, 2024

@Zachary St. Louis is right, Modern Designer is able to handle a much larger set of table data.  We have several lookups that pull over 1000 rows from SQL.  If you can convert your classic form to Modern, that will vastly improve performance overall.  

If you can't and you need two separate tables due to different fields required, separate SPs will at least prevent both tables from needing to load.

0 0
replied on August 15, 2024

Thank you all for your suggestions.

I did create a SP and it works well.  Thank you for that suggestion.

I also did convert to the New Designer and although it loaded quicker (93 rows), I found it VERY sluggish to scroll up and down.  So, I ended up moving away from Tables to Collections.

 

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

Sign in to reply to this post.