9 Replies Latest reply: May 16, 2011 1:40 PM by John Witherspoon RSS

    Union of Groups



      =count({$<BCShotFlowIndexA={">=$(bcVar1)<=$(bcVar2)"}>+$<DepoBCPeakVacA={">=(DeVar1)<=(DeVar2)"}>} LensKey)

      (Exatly what i am geeting and working)


      I wrote this setanalysis expression in a straight table so that it is working well for a individual fields of differant groups.


      My problem is, It is not gives the result if i were used groups instead of fields, for this i wrote the expression like this



      =count({$<GetCurrentField(bc)={">=$(bcVar1)<=$(bcVar2)"}>+$<GetCurrentField(De)={">=$(DeVar1)<=$(DeVar2)"}>} LensKey)

      (Exactly what i am getting and is not working.)


      Is it possible.?




      I hope you understand my explanation regarding my issue.


      Let me know where i made wrong and where to modify my expression.


      Reply with your suggestions....(Urgent)



        • Union of Groups
          Goran Korsgren


          I don't think it is possible to use anything else than field names on the left side of '=' in set modifiers, neither functions nor variables.

            • Re: Union of Groups

              Hi GandalfGray,


              Thanks for your reply.


              But this is working for me for a single field only what should i do for work with a group(having some fields).

              It is possible to get a single field from the group by writing GetCurrentField(GroupName).But this is not working for me why i don't know .


              If you had any ideas or suggestions share with me...



            • Union of Groups



              I had the same problem yesterday, when trying to make some operations over the fields inside a group. In my case, I solved it using the aggr function.


              I don't know if it would be useful in your case, but you can try it. Use as expression your count, and as dimensions, the fields included in your group.

              • Re: Union of Groups
                John Witherspoon

                Getcurrentfield() returns a TEXT STRING, the name of the currently-selected field in the group.  But you don't want that string, you want the FIELD ITSELF.  To get the field, you just use the group name itself as the field. In other words, assuming your expression is otherwise correct, and bc and De are your groups, I would expect this to work:


                count({<bc={">=$(bcVar1)<=$(bcVar2)"}>+<De={">=$(DeVar1)<=$(DeVar2)"}>} LensKey)

                  • Re: Union of Groups
                    Goran Korsgren

                    Hi John!


                    Are you sure it's possible to use groups instead of fields in the set expression of your solution?


                    It would be handy if it was, but I have tried it now, and it does not seem to work.

                    I have a cyclic group "cg", "Year" is one of the fields in that group.


                    The table using the cyclic group is never affected by the variable settings.

                    (313759 is the total number of "distinct AktivitetsID")


                    In the first table below i have

                    =count({<cg={">=$(cgVar1)<=$(cgVar2)"}>} distinct AktivitetsID)


                    in the second:

                    =count({<Year={">=$(cgVar1)<=$(cgVar2)"}>} distinct AktivitetsID)


                      • Re: Union of Groups
                        John Witherspoon

                        Well, no, I actually wasn't sure.  Just normally, you can use a field group anywhere you can use a field, so I assumed without even checking that you could do it here too.  Looks like I was wrong!  Sorry about that.  Honestly, it looks like a QlikView bug to me, though I'm sure they'd call it "working as designed" and we'd have to request this as a new feature.


                        OK, there's more than one way to do things.  Try this:


                        =count({<"$(=getcurrentfield(cg))"={">=$(cgVar1)<=$(cgVar2)"}>} distinct AktivitetsID)


                        As with any dollar sign expansion, the result of what's inside (i.e., the text string) gets literally inserted into the expression.  So that's one way to convert the string name of the field into the actual field itself.  It worked for me in a different example.  Hopefully it will work in the real application.  It's just a shame that the additional syntactical complexity was required.