Hi Bob, others,
I have a question.
I have CF where I need dynamic dropdown and need to show in text key information from 2 values, which are stored in different tables.
1st table shows all records where 1 column links to 2nd table as unique index.
I did try some options, but I cannot correctly set relation.
could u help me how get 2 values text key in dropdown, which are stored in different tables.
thx
Hi homeopat,
You could use a DB Read action and set the Relation to the second table - but it's probably simpler to use a Custom Code action to write the MySQL query and get the data that way. You need to add it to the $form->data array as a sub array where each entry has the 'value' and 'text' you need.
Bob
Hi Bob,
good point😉 second way is faster, I just want to try do in relations.
is it question of select in select and I dont know how set the condition in second table to get name depending on id from first table.
for example: master is list of transactions (where is column id) and second table is list of users.
Can I do virtual columns or overwrite some returning value in DB read action?
thx
Hi homeopat,
I just use the easy solution. You should be able to use the Relations tab in the DB Read to access the second table using the id to identify the record.
Bob
Hi Bob,
I understand you, but not sure if is it feasible.
example:
I get 10 records from fisrt table and i need to get names from second table for every record of first table. But dont know how join 2 columns (separate tables) to one column that i send to dynamic dropdown (text key).
I am not sure how get this result (conditions, next modifications in custom code?)
thx
Hi homeopat,
Have you looked at the Relations tab in the DB Read action?
Bob