Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Multiple JOOMLA USER types and GRID 19 Dec 2016 16:31 #14857

  • jamaza
  • jamaza's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 8
  • Thank you received: 0
I have a table called JOBS, and a XRef table called xExpertstoJobs, this XRef has two Joomla User type fields

On a JOBS collection view, I want to pull in the names from BOTH of these fields, however they are not rendering with the correct name and I can only pull in one

In the table view the fields are called expert_id and referrer_id

In the FIELD view at the side to drag them in they are called

user
user

Please Log in or Create an account to join the conversation.

Multiple JOOMLA USER types and GRID 20 Dec 2016 14:48 #14858

  • liubov
  • liubov's Avatar
  • Offline
  • Elite Member
  • Elite Member
  • (=) 10 mn and it's ready!
  • Posts: 279
  • Thank you received: 36
Hi Jamaza,

I am not sur your Table design is correct in order to use Xref but if i anderstand what you want to do, you should have 3 Tables involved.
- JOBS: (id, title, ...)
- EXPERTS: (id, title, FK [ JUser, ... ]
- xExpertstoJobs (job_id, expert_id, ...)

So with this N:m Pivot Table :
- A Job can needs One or Many Experts Features,
- An Expert can cover One or Many Jobs.

Then, in the Jobs View Layout, you could drag :
- job_title
- - Xref [ExpertstoJobs (on Job)]
- - - Expert_title
- - - FK [Juser]
- - - - Name
- - - - UserName
- - - - etc, etc,

And, in the Experts View Layout, you could drag :
- expert_title,
- FK [Juser]
- - Name
- - UserName
- Xref [ExpertstoJobs (on expert)]
- - FK [job]
- - - job_title

Hoping that can help you ...
The following user(s) said Thank You: admin

Please Log in or Create an account to join the conversation.

Last edit: by liubov.

Multiple JOOMLA USER types and GRID 16 Jan 2017 23:02 #14948

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
I had a look on your database design

Context I understood :
The 2 FK references to users are located in the EXPERTSTOJOBS table. N:1 relation
You want to list the users from the Jobs table.

Since ORM, this is incredibely simple to achieve.
This should work to grab the datas.
$this->orm(array(
	'relation' => array(

		'xexpertstojobs' => array(
			'select' => array(

				'expert_id.username',
				'expert_id.name',
				
				'referrer_id.username',
				'referrer_id.name',
			)
		)
	)
));
Then dump the loaded datas, and you will see the list of users behind the N:1 relation.

Need more explanation ?

EDIT : You need to download again because I fixed something on the ORM engine that was required for this operation.
Coding is now a piece of cake
The following user(s) said Thank You: MorganL

Please Log in or Create an account to join the conversation.

Last edit: by admin.
  • Page:
  • 1
Time to create page: 0.093 seconds
  I still don't believe he can really be human to do all this ! From all of the forums that I've ever participated in this is certainly the one that most encapsulates the feeling of being truly open source where everyone's opinions and contributions can and will shape the development of the service! It's truly awesome! Hope you enjoy cooking and look forward to reading and contributing to any of the editorial work that you proposed too!! Thanks
Gez (audibleid - JED)

Get Started