Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
dbaksa_1
Partner - Creator
Partner - Creator

Cyclic expression group

I'm trying to create an expression that will vary based on the Cyclic expression selected by the user. I have a Cyclic expression to select Domestic Revenue or Import Revenue, I want select expressions in the chart to change based on the selected Cyclic selection group.

I have tried the getcurrentfield function but it requires a group name. It appears that I cannot name a Cyclic expression group.

Any assistance will be appreciated.

1 Solution

Accepted Solutions
dbaksa_1
Partner - Creator
Partner - Creator
Author

John,

You have stated the problem correctly.

I actually just solved this puzzel by creating a function that reads row 1 of the table and the specific column that relates to the Cyclic group (Row One contains the header title). I move the title to a variable and then generate the balance of my expressions by reading the variable. IF( variable = Domestic, Y*X, Z*X).

I had to add a button to run the function after the Cyclic group was selected but it seems to do what I need for now.

Thanks,

Dan.

View solution in original post

10 Replies
Not applicable

Try creating a cyclic group called "MyGroup" with Domestic Revenue and Import Revenue.
The calculation expression in the chart would then be:

=sum(if(MyGroup = [Domestic Revenue] ,DM_val,
if(MyGroup = [Import Revenue],IM_Val)))

Depending on what the current selection is it with either sum Domestic Revenue (DM_val) or Import Revenue (IM_val).

dbaksa_1
Partner - Creator
Partner - Creator
Author

I'm not using a Dimension Group I'm using an expression group. I created the group by dragging one expression into another. When you do this QlikView groups the 2 expressions similar to a dimension group however I cannot give the expression group a name.

johnw
Champion III
Champion III

So you have "Domestic Revenue" and "Import Revenue" as expressions. You've grouped them so that you can select one or the other. Now, based on which of those is being displayed, you want ANOTHER expression to change, such as showing "Domestic Cost" or "Import Cost". Is that the basic idea?

I'd really have thought that a cyclic expression group could be named and the current expression referred to. But I'm not seeing a way to do it.

One workaround is what carneyfm mentioned - use a regular cyclic field group instead with fields "Domestic Revenue" and "Import Revenue", and use these to control whether your revenue and cost expressions show domestic or import data.

Another workaround would be to use a list box with values 'Domestic' and 'Import'. Use the selection to control whether your revenue and cost expressions show domestic or import data. Alternatively, have two different charts, one with domestic data and one with import data, and use the selection to control which chart is visible.

Finally, unless the expressions differ in ways other than which data is displayed, I would associate the 'Domestic' and 'Import' values with your actual data. Make them part of your main table. Then default QlikView logic would show one or the other based on your selection. This won't work if you show different kinds of data for domestic and import, of course.

dbaksa_1
Partner - Creator
Partner - Creator
Author

John,

You have stated the problem correctly.

I actually just solved this puzzel by creating a function that reads row 1 of the table and the specific column that relates to the Cyclic group (Row One contains the header title). I move the title to a variable and then generate the balance of my expressions by reading the variable. IF( variable = Domestic, Y*X, Z*X).

I had to add a button to run the function after the Cyclic group was selected but it seems to do what I need for now.

Thanks,

Dan.

Not applicable

Dan, I can propose you another solution:

Create an inline table made of two fields, first one is caption and the other is fieldname.

Then you set the field Caption as always one value selected ok ?

Then you change the expression such as =$(=only(FieldName))

I think that should work. This way when you select the field caption to displayn the expression will be changed according to the inline table.

I don't know if this is clear or not, but it should be ok.

Rgds,

Sébastien

dbaksa_1
Partner - Creator
Partner - Creator
Author

I'm not sure I follow your suggestion. I have a Cylic Expression Group in a striaght table how does a In Line Table help me connect the selection of the Cyclic Group when I change the group selection?

Not applicable

Hi daniel,

i have the same problem, can you share your function with me?

dbaksa_1
Partner - Creator
Partner - Creator
Author

Try this--

Reads the header column 3 and then populates an object variable.

Good Luck,

Dan

'Used to read row 0 column3
'Read Header to find specific column Name
Sub SelectRecordsCH433FieldName
dim SelectedItems
SelectedItems = ""
set table = ActiveDocument.GetSheetObject( "CH433" )
for RowIter = 0 to 0
'for ColIter = 3 to table.GetColumnCount-0
set cell = table.GetCell(RowIter,3)
'msgbox(cell.Text)
SelectedItems = cell.Text + "," + SelectedItems
next
IF SelectedItems <> "" THEN
SelectedItems = left(SelectedItems, len(SelectedItems) - 1)
set Objvar = ActiveDocument.Variables("vColumn3Name")
Objvar.SetContent SelectedItems, TRUE
END IF
end sub

Not applicable

Hi dbaksa,

                    How do you do get title name into variable when you change cyclic group. What i mean, how dynamically you can pass the title into variable. If you do reply on it, it will be appreciated.

Regards,

Ravi.