Open willypowwow opened 7 years ago
I need your complete query, including conditions and clauses. QQuery builds the joins as it encounters the need for them. It might see a join in a condition, or a clause, or in a subquery or conditional join, etc.
Joins are generally done with Expand clauses. Late in v2 I added conditions to expand clauses, so look at the 2nd parameter of an Expand clauses to add the condition you seek, provided you have upgraded to somwhere close to the latest v2. Something like this:
$clause[] = QQ::Expand(QQN::AppWork()->CfgTaskResult, QQ::AndCondition(QQ::Equal(QQN::Appwork()->TaskId, QQN::Appwork()->TaskIdObject->CfgtaskstatusresulAsTaskID->TaskId),
QQ::Equal(QQN::Appwork()->StatusId, QQN::Appwork()->StatusIdObject->CfgtaskstatusresulAsStatusID->TaskId)));
Note that for this to work, you will need a foreign key from AppWork to CfgTaskResult through TaskId. If you can't do that, then your only hope is a custom SQL query.
The conditional Expand did the trick, in case anyone else is watching this. Sorry for the late reply.
Great! You might look at porting to the latest, version 4 of QCubed. But its great to hear the someone is using it well.
Also, for anyone listening, I have started a concerted effort to port QCubed to the Go language. I have made significant progress, but much more needs to be done (as in every open-source project). If your company is interested in moving your app forward, you might consider that as well.
@spekary Why GoLang? What are the parameters you evaluated for the same?
The reason why I ask is: I wanted to do the same on Swift which is much more popular in terms of adoption because of well known reasons (iOS + Mac devs already use it and there are great frameworks being built around it already).
When I looked, Swift was Mac only, and did not have many 3rd party libaries that would be typical for PHP and web development. I like Go because of
That said, there are some limitations:
What are your thoughts on Swift?
Let's take this into another discussion.
This isn't truly an issue, but there I've been unable to get a question answered out in the usual places. My company has acquired an application which runs on an older version of QCubed. It's a very robust application with many users and generally works very well. We currently have a problem that we cannot seem to solve with QQuery.
We have two tables that are related by two fields. A SQL join of these would look like this:
FROM appWork a INNER JOIN cfgTaskRestult c ON a.TaskId = c.TaskId AND a.StatusId = c.StatusId.
We include this in QQuery like this:
QQ::Equal(Appwork->TaskId, Appwork->TaskIdObject->CfgtaskstatusresulAsTaskID->TaskId QQ::Equal(Appwork->StatusId, Appwork->StatusIdObject->CfgtaskstatusresulAsStatusID->TaskId
Unfortunately, this creates two separate Joins and two table aliases, one joining on TaskId and one on StatusId. Is there any way around this?
Thanks.