DropDown/DataBaseJoin - Show User Items

tiagovareta

Member
Hi,

I have a table / list where users can create records! In list view, each user only sees the records that he created: http://prntscr.com/i19qy8

In a form (other than this list) I have a DropDown / DataBaseJoin field, to select one of these records, which should have the option to select only the records that the respective user created.

To do this filter I have a field in the form: id_user_logado_sms_ind, which is hidden to go select the "id" of the logged in user, with the code:
$id_user = JFactory::getUser()->get('id');
$db = FabrikWorker::getDbo();
$queryidassessor = "SELECT id FROM tb_contactos_geral WHERE id_login_ctg = '$id_user'";
$db->setQuery($queryidassessor);
$id_assessor = $db->loadResult();
return $id_assessor;
And fill the field well with the "id", which I intend to: http://prntscr.com/i19up1

The issue is that the DropDown / DataBaseJoin field does not load user records.
In the field I have:
- http://prntscr.com/i19vgn
- http://prntscr.com/i19vq6

In the WHERE code, I have: {thistable}.id_assessor_sms_pred = '{id_user_logado_sms_ind}', but it does not work!
If I put: {thistable}.id_assessor_sms_pred = 2 , already works! However the value of the field: id_user_logado_sms_ind, can be 2 that it does not assume.

How can I resolve this situation?
 
{id_user_logado_sms_ind_raw} (with or without _raw) doesn't seem to be a full element placeholder, the tablename is missing.
It should look like {your-table___your-short-element-name} (3 underscores between table and element name)
 
{id_user_logado_sms_ind_raw} (with or without _raw) doesn't seem to be a full element placeholder, the tablename is missing.
It should look like {your-table___your-short-element-name} (3 underscores between table and element name)

Hi Troester!

My element full name is: tb_envio_sms_ind___id_user_logado_sms_ind
I put:
- {thistable}.id_assessor_sms_pred = '{tb_envio_sms_ind___id_user_logado_sms_ind}'
- {thistable}.id_assessor_sms_pred = '{tb_envio_sms_ind___id_user_logado_sms_ind_raw}'

Don't work...

I created a field of type "calc", instead of "field" with the same code:
$id_user = JFactory::getUser()->get('id');
$db = FabrikWorker::getDbo();
$queryidassessor = "SELECT id FROM tb_contactos_geral WHERE id_login_ctg = '$id_user'";
$db->setQuery($queryidassessor);
$id_assessor = $db->loadResult();
return $id_assessor;

I did the filter and it also did not work ...
I think it's not assuming the value of the fields, because if I put: {thistable} .id_assessor_sms_pred = 2, it works ...
 
{id_user_logado_sms_ind_raw} (with or without _raw) doesn't seem to be a full element placeholder, the tablename is missing.
It should look like {your-table___your-short-element-name} (3 underscores between table and element name)

Hi Troester!

Is there a way to solve this situation ??? I have to deliver the project tomorrow, and this part should be resolved ...
 
I don't understand completely what you are trying to get from where, but if hardcoded 2 is working and your query is returning 2 you should be able to do
{thistable}.id_assessor_sms_pred = (SELECT id FROM tb_contactos_geral WHERE id_login_ctg = {$my->id})
 
I don't understand completely what you are trying to get from where, but if hardcoded 2 is working and your query is returning 2 you should be able to do
{thistable}.id_assessor_sms_pred = (SELECT id FROM tb_contactos_geral WHERE id_login_ctg = {$my->id})

Hi Troester!!!

That's it!!! Many, many thanks !!!
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top