$enable_lookup_insert_popup = 1 does not function properly

OUR SYSTEM​

Your current DaDaBIK version​

You are using DaDaBIK version 11.3-Elba enterprise, installed on 08/02/2022 (installation code: 133315a7493334bfea), the latest version of DaDaBIK is 11.3-Elba released on 17/01/2022

You are runnning the latest release of DaDaBIK

In case you want to upgrade to a more powerful edition (from Pro to Enterprise/Platinum, from Enteprise to Platinum) please contact us.

System info​

PHP Version: 7.4.27

mysql version: 10.3.24-MariaDB-cll-lve

Web server: Apache/2

Client: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.80 Safari/537.36 Edg/98.0.1108.50

ISSUE:​

When $enable_lookup_insert_popup = 1, then one can add new values to a lookup table and insert these new values in the destination table.
We have 4 such lookup tables in use. In only one case I managed to get the function working properly. After some modifications to that lookup table, it didn't function properly anymore, so now I have no case where this funtions properly.
The operation of adding & inserting a new value ends with the message hereunder.

Unexpected error.png
The result of the operation is as follows:
  • The new value is added to the lookup table (which is good)
  • BUT you can only select that new value in the destination table after leaving edit mode of the destination table and going back in edit mode.
The lookup tables are very simple ones:
  • Two of them have a AUTO INT(11) AUTO_INCREMENT field as Primary Key
  • And a varchar(32) field where the values are stored
  • In the cases where there is no AUTO INT(11) field, then the varchar(32) field is the Primay Key
  • In the destination table the destination field is also varchar(32)
  • And "Lookup table primary key field", "Lookup table linked fields" and "Lookup table order by" are all three set to the varchar(32) field in the lookup table.
Please advise what is going wrong here!

Kind greetings,

Hendrik Simoens
 

eugenio

Administrator
Staff member
Hello Hendrik,
you said:
After some modifications to that lookup table, it didn't function properly anymore, so now I have no case where this funtions properly.
do you remember which modifications did you make to such table?

Best,
 
Eugenio,

I played with the settings "Is the field a required one?" and "Check for duplicated entries during INSERT" for both AUTO and the varchar (32) field in het lookup table. Both are YES for both fields now.
In the actual SQL-table, both fields must not be empty. AUTO is Primary Key. The varchar(32) field must be unique.
Note that I changed these values back and forth without any change to the behaviour I mentioned (ie I didn't get it going again). And anyway, for the three other tabels, I never got it working properly.
 
Eugenio,

I can send two log-files of our server-environmet: one wiht all the commands executed and one with the errors.
Where can I send them to?

Kind greetings,

Hendrik
 

eugenio

Administrator
Staff member
Hello,
there is a related known bug:
If you have two (ore more) select_single* fields in the same form having the same lookup table and you add a new option using the popup insert ($enable_lookup_insert_popup = 1), the new option will be immediately available for the listbox you are working on but not for the other ones (they will be available after having reloaded the page).
but I don't think this is your case.

More in general, unless you are using PostgreSQL, you need auto-increment PK to use this feature (I've realized this is probably not well documented, I will add some comments about it). There are a few other features that require auto increment PK, check the documentation (search "increment" and you should find them).

This explains why for some tables this is not working but does not explain why it is not working in the table where you have auto-increment PK.
Can you double check it?
Does the "unexpected error" message appear after having clicked on the INSERT button on the popup window?

If the application is public, I can have a look. You can open a support ticket writing to support at dadabik dot com if you want

Best,
 
Eugenio,

it is indeed not the related bug you mentioned and the "unexpected error" message appears after having clicked on the INSERT button.

BUT some feedback on het auto-increment PK.

Although one table had an auto-increment PK (field AUTO), in the Forms configurator "Lookup table primary key field" was NOT set to that field AUTO (but to the varchar(32)-field). I did change this "Lookup table primary key field" to AUTO and it is possible that after that change the function did work properly. BUT: the destination table contains more than 4.200 records and all these other records have been filled using the first setting of "Lookup table primary key field", so containing varchar(32)-values and not int(11)-values.

I will perform a test with a new table to find out.

Kind greetings,

Hendrik
 

eugenio

Administrator
Staff member
Hello,
I am not sure if I have completely understood your settings but Lookup table primary key field must be the primary key of the lookup table (which also must be in the pages tab, for that table, the value of "unique field"). If you set it to any other field you can get unexpected results.

Best,
 
Hello Eugenio,

I made a new lookup table; added a new field to our database retrieving its value from the lookup table; and used the auto-increment PK field as "Lookup table primary key field". And now everything seems to work properly.

Thanks for the advise!

Kind greetings,

Hendrik
 
Top