Forums

issue with model1 & model2 hasone

teldrive 16 May, 2014
I apreciate if someone can help, i made a diagram to explain it better
I select one row form a table(model2 "ator") based on condition of joomla-logged user
return array("ator.nif" =>$login);

after that I join with model1 "paper" all the rows that have same parameter " egrupo" of selected row['ator']['egrupo']
[attachment=0]Captura.JPG[/attachment]
all is working fine , but the issue is that as suggested in http://www.chronoengine.com/faqs/72-ccv5/5218-adding-1-more-belongsto-model-to-our-connection.htmlwe can call some row parameters from model2
but i couldn't get the value of row['ator']['ecoord'], what i need is a php row function that depending of value of this parameter shows or not the field
paper.rates:return ($row['ator']['ecoord'] >0? $cell : "0"); 

[attachment=1]Captura1.JPG[/attachment][attachment=2]Captura2.JPG[/attachment]
Max_admin 18 May, 2014
Hi teldrive,

You are doing this in the listing ? if yes then are you sure that the "ator" fields are loaded correctly ? please try to use one of its fields in the "columns list" box to make sure that the model is loaded before trying to use the field info into the functions box.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
teldrive 19 May, 2014
hi Max, thanks by reply
I have tried but failed, may be due to model2's "condition" returns only one raw , (it's fine because only one record has this ator.nif)
return array("ator.nif" =>$login);

it results interesting, after "join condition" applied, that paper.egrupo shows 4 raws but ator.egrupo not
[attachment=0]Captura.JPG[/attachment]
Max_admin 19 May, 2014
Please try to clear the "Fields" box because the "ator" table fields are not loaded in the query!

Its advised not to use the fields box before everything is working fine, its only useful when your table has a lot of fields, but in your case its not needed and CC will load all fields by default.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
teldrive 19 May, 2014
Answer
:D Great, Thanks Max, it works like a charm, first i followed your sugestion and it worked
after I did some additional testing, conclusion is that it's necessary to include "ator" fields(model2) in model 1 if you want to use them
[attachment=0]Captura.JPG[/attachment]
[attachment=1]Captura1.JPG[/attachment]
This topic is locked and no more replies can be posted.