Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Union of Groups

Hi,

=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)

Thanks....

9 Replies
gandalfgray
Specialist II
Specialist II

Hi

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.

Not applicable
Author

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...

Thanks.....

Not applicable
Author

Hi,

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.

Not applicable
Author

Hi Medina,

Thank you for your reply.

I didn't understand what u deliver.

can u give a clear idea about this.

Anything from you is a help for me.

Thanks..

gandalfgray
Specialist II
Specialist II

Hi Ravikumar

As I said, I don't think you can achieve what you are trying to do with set analysis.

You can't use what you get from the GetCurrentField(GroupName) function call on the left side of the set modifier expression.

Not applicable
Author

Hi Gandalf

Thank you for your reply

Send me the expression what you think by modifying my original expression.

Your information is valuable for me.

Thanks....

johnw
Champion III
Champion III

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)

gandalfgray
Specialist II
Specialist II

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)

groupsetanalysis.JPG

johnw
Champion III
Champion III

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.