Hi, I am having trouble formulating a seemingly simple Query with an outer join in Glorp. Let's use tables COMMAND and ERRMSG as an example where a COMMAND can have 0 to 1 associated ERMMSG. I want to query all COMMAND objects that have the word 'DATE' in either the command itself or in its ERRMSG. so what I have so far is this: mySesson read: COMMAND where: [:cmd| cmd text like: '%DATE%' OR: (cmd errmsg like: '%DATE')]. This creates an INNER JOIN and therefor never returns a command that has no errormsg associated. So far, I tried:
And a few variants that use q SimpleQuery and the where: and OR: methods: So far I had no luck at all. The web doesn't provide much information on this problem. Any hints or ideas? Joachim You received this message because you are subscribed to the Google Groups "glorp-group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/glorp-group. For more options, visit https://groups.google.com/d/optout. |
Sorry, I knew I'd make mistakes in posting this. The statement I tried is of course this: mySesson read: COMMAND where: [:cmd| cmd text like: '%DATE%' OR: (cmd errmsg text like: '%DATE')]. errmsg is not an attribute of the COMMAND table, but a table in itself that has a text attribute... Joachim
You received this message because you are subscribed to the Google Groups "glorp-group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/glorp-group. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by jtuchel
To make a relationship use an outer join, just send #asOuterJoin. e.g. (cmd errMsg asOuterJoin). You can even put that into an expression that defines a mapping so it's always an outer join.
On Fri, Nov 2, 2018, 03:51 jtuchel <[hidden email]> wrote:
You received this message because you are subscribed to the Google Groups "glorp-group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/glorp-group. For more options, visit https://groups.google.com/d/optout. |
Alan, this is so ridiculously simple and obvious that I can hardly believe I haven't tried this variant... So the correct and working statement is this: mySesson read: COMMAND where: [:cmd| cmd text like: '%DATE%' OR: (cmd errmsg asOuterJoin text like: '%DATE')]. I just write it down again to make it easier to find next time I am at this point - and maybe for others.... As always, thanks a million for your support! Joachim (how do you memoize all that stuff so many years after leaving Smalltalk...???) To make a relationship use an outer join, just send #asOuterJoin. e.g. (cmd errMsg asOuterJoin). You can even put that into an expression that defines a mapping so it's always an outer join. You received this message because you are subscribed to the Google Groups "glorp-group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/glorp-group. For more options, visit https://groups.google.com/d/optout. |
You're most welcome. Actually, it took me an embarassingly long time to remember. I knew it was possible, but I was on a tablet and couldn't run an image, so I had to look around in old presentations/documents on my drive. And I had an idea that maybe it was complicated, but the complicated thing is subselects.
On Fri, Nov 2, 2018, 08:01 jtuchel <[hidden email]> wrote:
You received this message because you are subscribed to the Google Groups "glorp-group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/glorp-group. For more options, visit https://groups.google.com/d/optout. |
Free forum by Nabble | Edit this page |