Community Support for OpenDocMan (Deprecated)

Full Version: User Defined Fields
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Not a bug as such, but I found a limitation that meant I had problems with User Defined Fields.

I updated 1.2.5.6 -> 1.2.5.7, as described in another thread, but still had problems making UDF work properly. After successfully creating a UDF field, I clicked on the link to add a new value and there were several php warnings:

Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in E:\xampp\htdocs\docs\udf.php on line 356
Warning: mysql_free_result() expects parameter 1 to be resource, boolean given in E:\xampp\htdocs\docs\udf.php on line 358
Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in E:\xampp\htdocs\docs\udf.php on line 377
Warning: mysql_free_result() expects parameter 1 to be resource, boolean given in E:\xampp\htdocs\docs\udf.php on line 384

Anyway, after a bit of investigation I discovered the problem. I had set up a UDF called 'partner'. The actual table set up by ODM was called 'odm_udftbl_partner', but the reference to this table stored in odm_udf.table_name was 'odm_udftbl_partn'. The name had been truncated as the field is limited to 16 characters. I changed the type to varchar(25), corrected the data and the problem went away.

I'd suggest increasing the 16-character limit in odm_udf.table_name, since 11 characters are immediately used up by the 'odm_udftbl_' prefix. Alternatively make sure it's clear that the user-defined table name is limited to 5 characters.

Cheers,
Mike
I will check it out. Thanks.
I've hit two issues on the UDF:

1. It only allows me type "pick list"

2. If I add the field, and then delete it before I add a record, I get:

Error in query: ALTER TABLE odm_data DROP COLUMN odm_udftbl_Testf. Can't DROP 'odm_udftbl_Testf'; check that column/key exists

It gets rid of it, it just generates the error.
Fixed in 1.2.5.7.

As for the single dropdown option, that it is the only UDF type available.