[ggl2-users] Re: filter + select:: Bug or feature?

  • From: Fernando González <fergonco@xxxxxxxxx>
  • To: ggl2-users@xxxxxxxxxxxxx
  • Date: Fri, 22 Jun 2012 11:03:12 +0200

It is indeed right. In the first case, the select is not accessing the
filter result, it is accessing the original "roi" variable and
"roi/gid" returns a sequence of all gids. Try this and you'll see:

show roi/gid;

In the second case, the select predicate gives an alias "r" to the
result of the filter and accesses every element in the resulting
sequence using that alias. Note that this is the only way to access
the result of the filter since using "roi" references the original
variable, as in the first case.

Hope it is clear.

On Fri, Jun 22, 2012 at 10:52 AM, Guillaume Chauvat
<guillaume.chauvat@xxxxxxxxxxxxxx> wrote:
> Dear ggl2-users,
>
> Lets assume roi is an input datasource containing a numeric field called
> gid. I'm surprised to notice that:
>
> show roi filter(roi/gid == 2) select(roi/gid);
>
> show roi filter(roi/gid == 2) select(r | r/gid);
>
> do not return the same results:
>
> [{gid=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]}]
>
> [{gid=2}]
>
> What's wrong?
>
> Thanks a lot for your help.

Other related posts: