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

Question

Question

Laserfiche Forms

asked on March 30, 2021

Hi All,

I have a development project ongoing using LF Forms.

The process of the project is to retrieve data from SQL using the lookup table rule and populate it to the field of LF Forms.

My question's,

1. How to popup a new window saying that "No Information Found", if there is noting match on SQL Data from a form field fillup by a user?

2. If the SQL DataBase has more same information, how to streamline or how to get the exact information on SQL DataBase using the lookup table?

 

Thank you

0 0

Replies

replied on April 5, 2021

Hi Matthew Tingey,

 

Thank you for your response to my question.

I will try your suggestion regarding the #1 question.

 

Thank you

1 0
replied on March 31, 2021

For #1

This is a little trickier than you might think, and is a little dependant upon how the data is being loaded into the form (adding rows to a table, populating a single-line field with one value, populating a single-line field with multiple values, populating a drop-down field with multiple values, etc.)  You can build events in Javascript that run when the lookup is complete, like this: 

$(document).on('lookupcomplete', function (event) {
  if(event.triggerId == 'Field1')
  {
    console.log('lookup complete - Field1 was changed by user and triggered the lookup to occur.');
  }
});

 

But that's where it can be a little tricky.  You could have Javascript check if the other field that should be populated is blank to determine if the lookup failed - but that's if it was a single-line field that only ever produces 1 result.  If there are multiple results, they'll show as suggested values.  A drop-down will show as select elements in the field.  Rows added to a table could be several other things.

One solution I've played with before is to have two different lookups.  One of them populates the actual values I want to show from the Table or View, and the other uses a Stored Procedure that returns a count of matching records - which populates into a hidden field.  Then you can add errors based on the populated value of the hidden field.  You could do this with Field Rules to hide/show an error message fairly easily.  You could employ Javascript to do pop-up messages or custom validation code if you wanted as well.

 

For #2

The system can handle the various options with databases fairly well.

Say you have a lookup that a user enters their first name, and it looks up the last name from an employee database table. 

If both values are Single-Line fields:

  • You'll see the last name field auto-populate if they are the only employee with that first name.
  • You'll see all the possible last names populate as suggested text if there are multiple employees with that first name.

 

Also, you can have multiple fields feed into the lookup.

Say you have a lookup that a user enters their first and last names, and it looks up their employee number from an employee database table. 

Since there are multiple lookup fields, the system will automatically create an "Auto fill" button that the user can click after entering both values, and that will trigger the lookup.

Personally, I use Javascript to hide the "Auto fill" button from the user, and programatically click the button when any of the fields used in the lookup are changed (after also checking none are blank).

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

Sign in to reply to this post.