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

Question

Question

Lookup procedure does not work with two fields

asked on September 3, 2014 Show version history

Hello Everybody,

I'm trying to use lookup on simple form:

screen shoot forms

 

Where storage is preset drop-down list with three values and position - one of the table columns and procedure is a result field.

However it never returns proper result in the procedure field - it stays 1 (default)

If procedure modified to work with one parameter only - position, it works properly.

Is there something I'm missing?

Thank you,

Vladimir

 

Lookup rules

screen shoot lookup

 

 

 

SQL

USE [LaserFiche]
GO

/****** Object:  StoredProcedure [dbo].[select_position_id]    Script Date: 09/01/2014 17:43:40 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

ALTER procedure [dbo].[select_position_id] @positionID nchar(35), @storageID nchar(50)
as 
declare @str_val int

IF @positionID != ''
    begin
        SELECT count(PositionID) as str_val
            FROM [Laserfiche].[dbo].[A_Physical_Record_requests] 
            where PositionID = @positionID and storageID = @storageID
    end
ELSE
    select 1 as str_val;

GO
form.png
lookup.png
form.png (26.88 KB)
lookup.png (25.26 KB)
0 0

Answer

SELECTED ANSWER
replied on September 8, 2014

Try setting up this lookup without any CSS or Javascript on the page. We tried it out internally (using a different database, but the same stored procedure and lookup rule), and it worked just fine for us. You should be seeing an autofill button once you set up a lookup based on two criteria. If that isn't showing up on this new, clean form, something else is probably wrong. In that case, go ahead and open up a support case. If it does work, that helps narrow down the issue.

0 0

Replies

replied on September 9, 2014

Hi Zachary,

You're right - it was something wrong with the form - I created it from scratch and it's working properly now.

Thank you for help.

Vladimir

1 0
replied on September 3, 2014

You cannot use a stored procedure like this with a table. You can however use it to fill a hidden field and use the values in the hidden field with Javascript to fill in the table. 

 

Take a look here for an idea of what I am saying:

https://answers.laserfiche.com/questions/55591/Populating-a-table-with-a-sql-lookup-values-via-dropdown-options-without-user-interaction

0 0
replied on September 4, 2014

Hi Kenneth,

I don't populate any tables from the lookup results - just use a table column as a source of the search. I've read that we can use column from table for lookup - it uses last row value. Lookup populates standard filed (planning to hide it after) and returns only one value.

Thank you,

0 0
replied on September 4, 2014

Hmm, I do not remember seeing that anywhere. I would love to see where you read that. I am not much help currently though, so hopefully someone else can comment with a solution/change to make

0 0
replied on September 4, 2014

Hi Kenneth,

It is in this thread:

https://answers.laserfiche.com/questions/57980/Forms-Lookup-Rule-does-not-populate,

Eric's reply:

...So, when you are matching a field in a table or collection, your lookup rule is not filling a field outside of that table or collection? This should work in Forms 9.1.1, although if the table has repeatable rows or if the collection is repeatable, the lookup will run on the last row or field that was modified in the collection.....

0 0
replied on September 9, 2014

Hi Vladimir, 

 

If your question has been answered, please let us know by clicking the "This answered my question" button on the appropriate response.

 

If you still need assistance with this matter, just update this thread. Thanks!

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

Sign in to reply to this post.