Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to reference Table Box from two different State ?


Hi All,

I am new to qlikview.

I have below issue.

I have one chart and one Straight Table.

Both chart and straight table are in two different State.

When user click on the Chart and straight table,

I want to associate that with one Table Box.

so, my questions is how can we associate Table box with two different state ?

Example :

Chart has Product.

Straight Table has Product.

I have Table box called Product Detail which contains detail information for Product.

I want when,

user click on the Product on the Chart or

Product on the Straight Table,

I want to show them all the detail from the Product Detail Table Box.

How can we associate table box with two different State ?

Thanks for help.

9 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Instead of a table box, use a Straight table. In each expression use a union of the two states.

=sum({[StateA] + [StateB]}LineSalesAmount)

If you don't have any expression, create a dummy one like:

=sum({[StateA] + [StateB]}1)

and then hide the column under presentation.

-Rob

http://masterssummit.com

http://robwunderlich.com

evan_kurowski
Specialist
Specialist

Hello Hailey,

Glad you asked this question, it's something to explore further, specifically with how to get a better control of passing selections across states.

The attached may illustrate functionality you outlined.  Two objects on the lower left will populate corresponding to selections made in objects assigned to alternate states [Peer1] and [Peer2]. (Each object's state is indicated by color coding the caption bar, if that makes it easier to visually track).

I really liked Rob's suggestion to create a straight table and assign a 'forcing' expression and then to hide that column, and that approach can work in this application.

What I wanted to approach is how to handle a contributing state if no selections have been made in that state.  You'll see in the screenshot, no selections have been applied in [Peer1], only in [Peer2], the only values that are being picked up are from [Peer2] alone.  In the event no selections have been made, I didn't want to populate the combined lists with all possible values, just values associated with a selection.

20140807_alternate_states_contributing_to_unified_selections.png

Not applicable
Author

Thanks Ron for your time and help on this.

I have eveyrthing as a Dimension.

I does not need to Sum any field as Expression.

I have two state - one is Inherited and other one is my newly created one.

you have mentioned about,

=Sum({[StateA]+[StateB]}Amount)

should it work below,

=Sum({[Inherited]+[mystate]}1)

I have tried like above but it's not working.

can you please help me on this ?

Thanks for your time on this.

Not applicable
Author


Hi Bob,

I have tried like above expression in straight table.

=sum({[StateA]+[StateB]}1)

if we select Product from StateA and after that on the next tab,

if we select Product from StateB,

Straight Table shows Both.

we need to shows product detail in straight table which was selected last.

in our above case,

we have selected Product from StateB last,

so, Straight table should show only that Product detail in straight table.

any thoughts on that ?

Thanks for your help.

evan_kurowski
Specialist
Specialist

Hailey Desai wrote:

I have two state - one is Inherited and other one is my newly created one.

you have mentioned about,

=Sum({[StateA]+[StateB]}Amount)

should it work below,

=Sum({[Inherited]+[mystate]}1)

I have tried like above but it's not working.

can you please help me on this ?

Thanks for your time on this.


Hello Hailey,

There is no state [Inherited] (unless you explicitly created a state named [Inherited], which isn't a good idea because that would be confusing).  Otherwise if you see the listing <inherited> in the drop down list, it means that the object in question is going to have its selection state passed to it from a parent object.

You can assign entire sheets in the application to an Alternate state, so let's say if the sheet were placed in [StateA], and you have Chart1 on that sheet that is assigned state <inherited>, then Chart1 will also calculate as residing in [StateA].  If you switch the Alternate state of the Sheet, the <inherited> objects will follow.

There is the base state however, which is referred to as <default>.  Every QlikView application starts with a <default> state.

If you want to reference the selections from the <default> state, use '$' in the set analysis syntax, so to combine the selections from the default state with an alternate state, use:
Sum({$+[StateA]} Amount)

Not applicable
Author


Thanks Evan.

below is my another questions.

I have tried like above expression in straight table.

=sum({[StateA]+[StateB]}1)

if we select Product from StateA and after that on the next tab,

if we select Product from StateB,

Straight Table shows Both.

we need to shows product detail in straight table which was selected last.

in our above case,

we have selected Product from StateB last,

so, Straight table should show only that Product detail in straight table.

any thoughts on that ?

Thanks for your help.

evan_kurowski
Specialist
Specialist

Hailey Desai wrote:


Thanks Evan.

below is my another questions.

I have tried like above expression in straight table.

=sum({[StateA]+[StateB]}1)

if we select Product from StateA and after that on the next tab,

if we select Product from StateB,

Straight Table shows Both.

we need to shows product detail in straight table which was selected last.

in our above case,

we have selected Product from StateB last,

so, Straight table should show only that Product detail in straight table.

any thoughts on that ?

Thanks for your help.

Hello Hailey,

I've worked something out for this scenario, but before you try it, maybe it would be good to go back and look at your requirements.

If you are not combining (unioning) the selections made in [StateA] with [StateB], then why preserve the selections made across multiple alternate states at all?  If you are only evaluating one set of state selections at a time, leave alternate states out of the design, and have the end-user keep reapplying their new set of selections over the prior set in the <default> state.  If they want to return to the last selection, use the back/forward navigations.  Are you making this more complicated than it needs to be?

Now for the scenario proposed:  I could see this maybe being used in some kind of game scenario or something, where User A can only see and interact with Sheet in [StateA] and User B can only interact with sheet in [StateB] and they have to pass their selections back and forth to each other to a common area without interfering or tipping each other off.

20140808_alternate_states_sequencing_last_selection.png

Since there doesn't seem to be a way to navigate through prior selections made in alternate states in the same way that you can in the <default> state, I had to shift prior selection tracking logic over to variable/trigger.  Also, if an end user REPEATS their identical last selection, it doesn't cover all scenarios, this works as long as the end-user makes any kind of change in the current selection.


The attached application covers the functionality you outlined, but my wishlist for making this easier next time are the combinations of Alternate State set-analysis with existing functions (which might look something like this):

Hypothetical Syntax:

GetSelectedCount( DISTINCT {[StateA]+[StateB]} FIELD)  //Distinct list of selections between [StateA] + [StateB]

GetFieldSelections( {$1 [StateA] } FIELD) //Get the prior set of selections made in FIELD in [StateA]
GetCurrentSelections( {[StateB]} )  //Get the current selections of [StateB]

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Evan,

The ability to specify a State in GetSelectedCount/GetFieldSelections/GetCurrentSelections will be available in SR8 which is now in beta.

-Rob

evan_kurowski
Specialist
Specialist

Rob Wunderlich wrote:

Evan,

The ability to specify a State in GetSelectedCount/GetFieldSelections/GetCurrentSelections will be available in SR8 which is now in beta.

-Rob

Yessss!!  Excellent news.