Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Basic QlikView Syntax

Hello all,

I'm quite new to QlikView and it still takes me a hugh effort to get the basic syntax done. Does anyone has kind of a syntax overview for the basic things?

Here are my problems (and I think they are so easy to answer for you)

1.) I need to know how to create a query with a condition, regardless what other selections are made, like --- Sum(Units) if Year = 2009--- Im getting so frustrated that either I need to select 2009 to see a result or I see the result and whenever I select someting else it changes. I need to store it in a variable to be able to calculate with it..so it should not change.

Then I would like to be able to combine static and dynamic, like sum(units) if Segment = "xy" and Year = {} (I should be able to select the year in the list box.

If I would get a solution for this it would really help!

2.) I was wondering whether I can have 2 list boxes with the same content but independent from each other. I need to store selections in 2 variables based on the same list box. Like variable1 = Salesman1 from list box Salesman and variable2 = Salesman 10 from list box salesman. Is it possible to tell qlikview..what is the first and what the second selection...

There is much more to ask but If you guys could help me with that I would be very happy!

Regards

Tom

9 Replies
Not applicable
Author

Hi Thomas,

Pls correct me if i understood your problem correctly.

1. Your first questions is - Irregardless of any selection you want to display the no of units only for the year 2009. If it soo then you can make use of SET Analysis --> Sum({1<YEAR={2009}>} Units)

2. I couldn't able to get your 2nd point. Pls be clear what you want to achieve (end result).

Regards

Rajesh

Not applicable
Author

Hi Rajesh,

thanks for the answer, will try out immediately.

For the 2nd point I would like to have the same as the 1st point but also add another dynamic selection like a fixed year and a dynamic Month etc.

any idea for the list box problem?

Not applicable
Author

Sorry, i could understand your list box query only. Can you be detail or what is the output needed?

Regards

Rajesh

Not applicable
Author

I need to fill 2 variables with 1 + 1 or 1+ 2 or more values from the same list box or duplicate the listbox but detached so i can independently make a selection from the same field.

Like list box salesman

select salesman 1 from salesman (then all the others are greyed out)

then in the second listbox salesman I need to select salesman 2 or salesman 3,5,8

so that i can compare them.

You know what I mean?

michael_anthony
Creator II
Creator II

for your second issue you can create a second copy of the field you want to compare against and then use set analysis to reference selections made in that field - this will let you combine the base and comparison values in same chart.

eg. Make a copy of Salesman field in script and call it Salesman_2.

In chart create first expression being Sum(Units).

Second Expression is Sum({$<Salesman = Salesman_2>} Units).

Note that 2nd expression will be 0 until you select at least 1 value (which makes sense in the set analysis).

You can add any other set tests such as Year = 2009 etc into the expressions as required.

Not applicable
Author

Hi Michael,

thanks for the answer, but I dont really understand how to do it.

You mean I should load the same field twice as different names?

like

Load

[Sales Name] as Salesman,

[Sales Name] as Salesman2,

...

?

but then still everything in the list box salesman2 is greyed out as soon as I select a name from salesman and I can only select the already selected name from the list box salesman.

michael_anthony
Creator II
Creator II

Because your creating Salesman and Salesman2 in the same load statement they are linked together which is why happens. Instead:

Create Salesman (or even leave as [Sales Name]) as usual.

Then do a separate load:

Salesman2_Table:

NOCONCATENATE LOAD

[Sales Name] as Salesman2

RESIDENT relevant table.

This creates Salesman2 field as an island, separated from the rest of your data structures. As an island, Salesman2 is unaffected by selections in any other field. That way you can select values in Salesman2 purely for use by the Set Analysis test in your chart expression.

Not applicable
Author

Thank you very much! that really helped!

I was wondering as I store the name in a variable, if I select more then one name it doesnt show anything in the text box (which basically shows the variable), is there a way of showing all names selected? if possible with a divider?

you know what I mean?

michael_anthony
Creator II
Creator II

Use function GetFieldSelections(fieldname, valuesep, maxvalues). valuesep is the delimiter - defaults to ",". Maxvalues is how many individual selections displays before showing x of y.