help spot issue with single_select?

larryk

Well-known member
I must be missing something:

simple schema

master_table
ID
Special_Number

activity_table
ID
master_table_ID
master_table_Special_Number


So working with Activty Table in the configurator:

the Master_table_ID is single_select where
lookup table name : master_table
Lookup table primary key field: ID
Lookup table linked fields: ID

==> ALL is good, no problems. When inserting a new Activity Table record, the master_table_ID fiels is prepopulated and selected.

however... for the special number (WHICH IS basically set up the same, excact way)

the master_table_Special_Number is single_select where
lookup table name : master_table
Lookup table primary key field: Special_Number
Lookup table linked fields: Special_Number


==> on insert, the dropdown is populated, BUT is NOT selected?
how can that be?
The values are in the dropdown, but the specail number field is not auto selected?

If Master_table_ID is working, why isn't master_table_Special_Number?

thanks!




You are using DaDaBIK version 10.1-Manarola enterprise, installed on 07-01-2020 (installation code: 157025efd31de5bb7d), the latest version of DaDaBIK is 10.2-Manarola released on 07-15-2020
 

larryk

Well-known member
just to be sure you see what is happening/not happening:

1) I vew the results grid for Master Table
2) I click edit for a given record...
the selected record has:
ID = 101
Special_Number = 456

3) on the Edit page, scroll down to the master detail section,
for Actitivity Table, I click "create new item"

4) on the insert for Activity Table:
master_table_ID is selected from the dropdown (all good). this field is showing the value.
master_table_Special_Number is NOT even though the value "456" IS IN the dropdown values?

why isn't 456 being pre selected from the values in the dropdown?
OR how do you force it to select it?

why does master_table_ID work correctly but master_table_Special_Number does not?



NOTE: I know master_table_ID is the true primary and forigen key in the schema, but Dadabik said it is not requried?
Is there a setting I need to turn off/on to allow master_table_Special_Number to be selected?
 

larryk

Well-known member
anyone have any thoughts?

what could cause a dropdown NOT to select the "value"... which is IN the list of values?
thanks!
 

Martin68

Well-known member
larryk Wrote:
-------------------------------------------------------

> simple schema
>
> master_table
> ID
> Special_Number
>
> activity_table
> ID
> master_table_ID
> master_table_Special_Number
>

Hi Larry,

i am sorry, my last english-lesson is about 35 years ago and so i have some problems to understand your problem. If you re patient enough, we could try step by step.

My first question is about your datastructure: why do you save the "Master special number" in two tables? i would have expected a normalized data model in which you use a "JOIN" to get the Special Number if you need it.

"Master_table_ID" in activity-table seems for me to be a foreign-key to master-table-id, correct?

Kind regards

Martin
 

larryk

Well-known member
Hi Martin,
Thanks for the reply and please excuse my late response (life got busy) :)

The Master_table_ID, is the primary ID (all good).
The Master special number, is unique, BUT not every record in this table gets a special number.

An example of what I'm trying to do:
Pretend you have a library and it is full of books.
Some books have an audio book, some do not.

So master_table_ID is for every book.
and the master_special_number is for add to the record IF a book also has an audio book.


TO answer your question,
"Master_table_ID" in activity-table seems for me to be a foreign-key to master-table-id, correct?
==> YES

So why can't Special Number do the same thing as the master table ID?

Everything is working EXCEPT that the new record creation does NOT pre-select the special number?
How to pre-populate it? I just need to tell the dropdown selection field to "select it".
How to do that?
 

larryk

Well-known member
Eugenio,

What would be the best way to select the correct option (from the pre populated) list of options in a dropdown, when the page loads?

thanks
 

Martin68

Well-known member
larryk Wrote:
-------------------------------------------------------

> So why can't Special Number do the same thing as t
> he master table ID?
>
> Everything is working EXCEPT that the new record c
> reation does NOT pre-select the special number?
> How to pre-populate it? I just need to tell the dr
> opdown selection field to "select it".
> How to do that?

A question: do you use the detail-view for entering the special-numbers, or do you use a seperate dadabik-Page for entering the special-versions? In my project I use the master-detail-view about twenty times and whenever I got problems it was a incorrect definition of the master/detail-values in form configurator...

Martin
 
Top