Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Not applicable

what is alternate states in Qlikview ?

what is alternate states in Qlikview ?

1 Solution

Accepted Solutions
MVP
MVP

Re: what is alternate states in Qlikview ?

Source : QlikView Reference Manual

Alternate States

Description

You can use Alternate States to perform comparative analysis between sets of multiple data items, for example for basket analysis purposes. A state holds a set of selections.

The QlikView developer can create multiple states within a QlikView document and apply these states to specific objects within the document. The end-user can create copies of these objects (server objects) and then put those objects into different states.

The most important difference between Detach and Alternate States is that ALL objects in a given state will respond to user selections made in that state. Objects in a given state are not affected by user selections in the other states.

Alternate States functionality is not accessible in the load script.

Note!
Alternate States functionality is enabled by a QlikView developer and should be used with caution as it can cause great confusion with end-users as there is no automatic on-screen indication that objects or expressions are in, or reference, alternate states. It is up to the QlikView developer to provide this information to the end-user using the StateName() function.

Setting Alternate States

Do the following to enable and set alternate states:

  1. Click Alternate States... in the Document Properties: General tab.
    The Alternate States dialog opens.
  2. Click Add... to create a number of states, and name them. The names will be referred to as state identifiers.
  3. Click OK to close the dialog.

Now the QlikView developer can create new Alternate States from within screen objects.

End-users who access QlikView documents from a QlikView Server can make use of Alternate States but cannot create Alternate States.

Assigning States to Objects

Do the following to assign a state to an object:

  1. Open the Properties dialog and select the General tab.
  2. Set Alternate State to the state identifier you want to use for the object.

The object will now be independent from the rest of the document in terms of selection, unless other objects are set to the same state.

There are two states that are always available; default state and inherited. The default state is the state where most QlikView usage occurs and is represented by $. The QlikView document is always in the default state. Objects can inherit states from higher level objects, such as sheets and containers. This means that states are inherited as such: Document - Sheet - Sheet Objects. The sheets and sheet objects are always in the inherited state unless overridden by the QlikView developer.

Comparing Alternate States

You can compare two states on the same object. For example, you can create a line chart to display both states of the data with the same axis by assigning a state in the expression using Set Analysis.

Example:

If you have defined the states Group1 and Group2, you can compare the average of field Adj.Close for the groups by showing these two expressions in a line chart:

Avg({[Group1]} [Adj.Close])

Avg({[Group2]} [Adj.Close])

Logical Behavior when Using Alternate States

Pressing the Clear button affects all states.
In the Inter Explorer plugin, a menu item has been added to the Clear button drop-down menu that allows a user clear the selections of a specific state. This menu is not available in the Ajax client, but the same function can be achieved by creating an action button connected to the Clear action with a specific state.

Pressing the Back and Forward buttons affects all states. There is no mechanism to move back and forward through specific states.

Pressing the Lock and Unlock buttons affects all states. It is not possible to lock and unlock specific states with these buttons. It is possible to lock specific fields in states by using the right-click menu on list boxes in a specific state.

The menu items in the Selections menu apply to all states. There is no mechanism to affect specific states in this menu.

Note!
Alternate States can be used with linked objects. The state applies to all instances of an object. Changing a state on a linked object will put the other linked objects into the same state.

Note!
Variables belong to the default state. Changes in other states will not affect variable values.

Note!
Triggers fire in all states.

Note!
Actions can be set to occur in specific states. One known exception is the Run Macro action. It can be set to run in a specific state; however macros fire in all states.

Note!
Objects that make use of a missing state (the state was removed by a developer) will revert to the default state though the Alternate State drop-down, that will display information such as:
AlternateStateName <unavailable>.

Note!
It is not possible to use chart field functions in conjunction with Alternate States as these functions do not have a set_expression parameter to set the state.

View solution in original post

7 Replies
Not applicable

Re: what is alternate states in Qlikview ?

hi rahul please go through the link below mentioned

Living QlikView: Alternate States Use-Cases

Re: what is alternate states in Qlikview ?

Alternate States allow you to have two expressions on the same chart that you can drive the selections on common dimensions independently.

For example Expression1 can show sales of product A,B,C whilst Expression2 can show sales of product X,Y, Z.

If you try this without alternate states, selecting poduct A,B,C will affect both charts.

Alternate states allow you to create two product list boxes, one is linked to State1, the other to State2.

Expression1 is linked to State1 selections and Expression2 to State2 selections.

Selections in the State1 list boxes only affect Expression1.

Selections in the State2 list boxes only affect Expression2.

There is an example of this in the Getting Started With QlikView 11 demo application.

MVP
MVP

Re: what is alternate states in Qlikview ?

Source : QlikView Reference Manual

Alternate States

Description

You can use Alternate States to perform comparative analysis between sets of multiple data items, for example for basket analysis purposes. A state holds a set of selections.

The QlikView developer can create multiple states within a QlikView document and apply these states to specific objects within the document. The end-user can create copies of these objects (server objects) and then put those objects into different states.

The most important difference between Detach and Alternate States is that ALL objects in a given state will respond to user selections made in that state. Objects in a given state are not affected by user selections in the other states.

Alternate States functionality is not accessible in the load script.

Note!
Alternate States functionality is enabled by a QlikView developer and should be used with caution as it can cause great confusion with end-users as there is no automatic on-screen indication that objects or expressions are in, or reference, alternate states. It is up to the QlikView developer to provide this information to the end-user using the StateName() function.

Setting Alternate States

Do the following to enable and set alternate states:

  1. Click Alternate States... in the Document Properties: General tab.
    The Alternate States dialog opens.
  2. Click Add... to create a number of states, and name them. The names will be referred to as state identifiers.
  3. Click OK to close the dialog.

Now the QlikView developer can create new Alternate States from within screen objects.

End-users who access QlikView documents from a QlikView Server can make use of Alternate States but cannot create Alternate States.

Assigning States to Objects

Do the following to assign a state to an object:

  1. Open the Properties dialog and select the General tab.
  2. Set Alternate State to the state identifier you want to use for the object.

The object will now be independent from the rest of the document in terms of selection, unless other objects are set to the same state.

There are two states that are always available; default state and inherited. The default state is the state where most QlikView usage occurs and is represented by $. The QlikView document is always in the default state. Objects can inherit states from higher level objects, such as sheets and containers. This means that states are inherited as such: Document - Sheet - Sheet Objects. The sheets and sheet objects are always in the inherited state unless overridden by the QlikView developer.

Comparing Alternate States

You can compare two states on the same object. For example, you can create a line chart to display both states of the data with the same axis by assigning a state in the expression using Set Analysis.

Example:

If you have defined the states Group1 and Group2, you can compare the average of field Adj.Close for the groups by showing these two expressions in a line chart:

Avg({[Group1]} [Adj.Close])

Avg({[Group2]} [Adj.Close])

Logical Behavior when Using Alternate States

Pressing the Clear button affects all states.
In the Inter Explorer plugin, a menu item has been added to the Clear button drop-down menu that allows a user clear the selections of a specific state. This menu is not available in the Ajax client, but the same function can be achieved by creating an action button connected to the Clear action with a specific state.

Pressing the Back and Forward buttons affects all states. There is no mechanism to move back and forward through specific states.

Pressing the Lock and Unlock buttons affects all states. It is not possible to lock and unlock specific states with these buttons. It is possible to lock specific fields in states by using the right-click menu on list boxes in a specific state.

The menu items in the Selections menu apply to all states. There is no mechanism to affect specific states in this menu.

Note!
Alternate States can be used with linked objects. The state applies to all instances of an object. Changing a state on a linked object will put the other linked objects into the same state.

Note!
Variables belong to the default state. Changes in other states will not affect variable values.

Note!
Triggers fire in all states.

Note!
Actions can be set to occur in specific states. One known exception is the Run Macro action. It can be set to run in a specific state; however macros fire in all states.

Note!
Objects that make use of a missing state (the state was removed by a developer) will revert to the default state though the Alternate State drop-down, that will display information such as:
AlternateStateName <unavailable>.

Note!
It is not possible to use chart field functions in conjunction with Alternate States as these functions do not have a set_expression parameter to set the state.

View solution in original post

Not applicable

Re: what is alternate states in Qlikview ?

an Alternate state holds a set of selections.

selections in an alternate state will not affect the selections in other states.

so we can create two or more alternate states with different selections  for same data.

It is useful for creating Comparative Analysis.

we can create alternate states in Settings menu - Document propeties - general tab - alternate states button

aaroncouran
Contributor III

Re: what is alternate states in Qlikview ?

http://livingqlikview.com/alternate-states-use-cases/

This blog has moved and this page is now located here:

igor_zhilin
New Contributor III

Re: what is alternate states in Qlikview ?

A question:

I have precisely the use case when I need to benchmark sales by Shop Group 1 with sales by Shop Group 2. For this, I made two charts. I assigned chart 1 to State "Shop Group 1" and Chart 2 to State "Shop Group 2". Just as described in QV manual.

Now the tricky part: I need a list box that will work for both states. This list box will select year and month for Shop Group 1 and Shop Group 2. It makes sense to compare the comparable (hence: same) periods, does not it? Thus, I expect one list box with time period to suffice.

Anyone ever implemented such a shared state? Or am I missing something and this functionality is readily available in QV?

Thank you.

Not applicable

Re: what is alternate states in Qlikview ?

So can someone elaborate on Bookmark vs Alternate State?

  • So far it seems like both (Bookmarks and Alternate States) can be used in Set Expressions,
  • But only Alternate States can be "linked" to sheet objects so that changes (i.e. clicking on an item in a Listbox) will filter only the Alternate State to which it's linked?