DaDaBIK
This forum is devoted to the discussion about the software DaDaBIK database front-end
the PHP Database application generator for MySQL, PostgreSQL and SQLite; also available for Wordpress.

Welcome! Log In Create A New Profile

Advanced

using masql field type set()

Posted by tory2307 
using masql field type set()
March 16, 2019 03:04AM
My database is developped with Mysql Workbench. I use many fields of the field type set(), the options mainly with long text sentences.
I did not find an option to use this hardcoded options in the database also in dadabik. It is only possible to hardcode the options in dadabik using the ~option 1~option 2~ etc. syntax. In one field i have a total of 18 options with each option with long sentences. It seems as if the field for the hardcoded options is too small for such an amount of text. What can i do?
Re: using masql field type set()
March 16, 2019 03:45AM
Hello,
the mysql field type ENUM is automatically translated into a select_single DaDaBIK field with hardcoded options.

The field type SET, instead, is not directly translated.

The field for the hardcoded options accepts max 100 characters so If you have 18 long sentences yes, you are right, it is probably not enough.

What you can do is editing the file /include/internal_table.php, in particular this part:

$int_fields_ar[$ar_index][0] = "Hard-coded list of the options:";
$int_fields_ar[$ar_index][1] = "select_options_field";
$int_fields_ar[$ar_index][2] = "text";
$int_fields_ar[$ar_index][3] = "100";

change 100 with whatever you need and from phpmyadmin change the field select_options_field in dadabik_forms too, if you need more than 500 chars (now it is a varchar 500).

However I don't recommend this changes to the DaDaBIK core code, also because every time you upgrade DaDaBIK you will have to edit this again. What I recommend is to use a separate lookup table containing the options, it's a cleaner solutions.

Best,

________________________________________________________
Eugenio |\.-./| DaDaBIK developer and project admin
Re: using masql field type set()
March 17, 2019 04:52AM
Hello,
next problem: even if the length of the options field is sufficient, nothing is saved to the database. You know, in a field type of set you can choose more than one option. Dadabik accepts only one (error message), and then doesn't save it in the database. With phpmyadmin it is possible wiithout problems to choose more than one option and the result shows up in the dadabik grid. After editing the dataset the set() fields are empty again. Unusable.

Best
tory2307
Re: using masql field type set()
March 18, 2019 01:55AM
Hello,
if you need to save multiple options, you have to use one of these dadabik field types:

- select_multiple_menu
- select_multiple_checkbox

the corresponding db field type must be varchar (or text if varchar is not enough) and DaDaBIK saves the values as:

~option1~option2~

the SET field is not directly supported. If you have data already saved in a SET field, you have to convert the content to the DaDaBIK format first.

Best,

________________________________________________________
Eugenio |\.-./| DaDaBIK developer and project admin
Sorry, only registered users may post in this forum.

Click here to login