Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Not applicable

Ho to create cyclic group using script

Hi guys,

Is there any way to create a cyclic group in the script instead of defining it in document properties?

Thanks in advance,

Aldo.

20 Replies
Highlighted
MVP & Luminary
MVP & Luminary


Aldo wrote:I successfully created some variables, but I can not create variables where I need to calculate Sums, etc


You can assign expressions to variables like:
SET FinalAmount = sum((UnitPrice-Discount) * Quantity);

and then use the expression in a chart as:
=$(FinalAmount)

Is that what you are after?


Aldo wrote: I also want to know if there is any statement (in qlikview script) to be used like "Switch" or "Select Case" instead of dealing with a lot of "Ifs".


QV Script provides a Switch Case statement. It's a control statement, so it cannot be used in a LOAD statement, which may be what you are looking for. There are alternatives to nested if(), such as mapping or the match() function. If you can post some specific examples of what you are dealing with, perhaps we can provide some suggestions.

-Rob

Highlighted
Specialist II
Specialist II

Aldo, in standard Qlikview help you can find such description this function:

only( [{set_expression}] [ distinct ] [ total [<fld {, fld}>] ]expression)

If expression or field iterated over the chart dimension(s) contain one single value, that value is returned, else NULL is returned. Only can return numeric values as well as text values.



Highlighted
Not applicable

[View:http://community.qlik.com/cfs-file.ashx/__key/CommunityServer.Components.UserFiles/00.00.02.89.41/Test_2D00_Creating-Group-Sample-20100408000.qvw]

Guys,

I try Anatoly's approach, but something is missing.

Please take a look at the attachment.

Actually, I need to make the Table showing the sales by Db or Company or Division.

Rob, I am using your suggestions.

Thanks in advance for any help.

Aldo.

Highlighted
Specialist II
Specialist II

Aldo, I fixed your example.

see in attachment.

View solution in original post

Highlighted
Not applicable

[View:http://community.qlik.com/cfs-file.ashx/__key/CommunityServer.Components.UserFiles/00.00.02.89.41/Test_2D00_Creating-Group-Sample-20100408001.qvw]

GREAT!

Thanks a lot!

Could you help me fixing the SET statement (in script) for variable "vdbOrCompOrDiv" in order to make Table2 working?

Take a look in the attached file.

Thanks again.

Aldo.

Highlighted
Specialist II
Specialist II

Aldo, what do tou want to achieve in table2?

Highlighted
Specialist II
Specialist II

Aldo, What do you want to achieve in table2?
Highlighted
Not applicable

The same thing as the first table, but creating the variable in the script, instead of typing

=CHR(91) & $(vCurField) & chr(93)

in the dimensions of the table.

Thanks,

Aldo.

Highlighted
Specialist II
Specialist II

see in attachment
Highlighted
Not applicable

Fantastic!

Thanks again,

Aldo.