Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Not applicable

Selecting rows with the same attribute

I have a table, lets call it Customers. Each customer has an address, phone number, etc. This is represented as a Straight Table with the customer ID as the dimension.

I want a solution where I can click on a customer, and another straight table will appear (Ill do getSelectedCount here), and this new table will list the customers who have the same phone number, or same address, or same whatever other attribute, as the selected customer.

Can anyone guide me as to how this might be implemented?

thanks!

Tags (2)
1 Solution

Accepted Solutions
MVP
MVP

Re: Selecting rows with the same attribute

Gerry,

you could create this second table with dimension Customer ID and as expression(s) something like:

=only({<Customer=p(), CustID= >} Customer)

=only({<Adress=p(), CustID= >} Adress)

=only({<Phone=p(), CustID= >} Phone)

The set expression will set the Customer Name, Adress or Phone to the one selected, and clears the selection in Customer ID.

See attached for a simple sample.

Regards,

Stefan

6 Replies
MVP
MVP

Re: Selecting rows with the same attribute

Gerry,

you could create this second table with dimension Customer ID and as expression(s) something like:

=only({<Customer=p(), CustID= >} Customer)

=only({<Adress=p(), CustID= >} Adress)

=only({<Phone=p(), CustID= >} Phone)

The set expression will set the Customer Name, Adress or Phone to the one selected, and clears the selection in Customer ID.

See attached for a simple sample.

Regards,

Stefan

Not applicable

Re: Selecting rows with the same attribute

this is amazing!

thank you so much for your help! The p() function was unknown to me so Ill study that tonight.

One more thing - I'd like to show the customer name in the name column at all times.

So..

=only({<Adress=p(), CustID= >} Adress)

=only({<Phone=p(), CustID= >} Phone)

...are perfect, but

=only({<Customer=p(), CustID= >} Customer)

Ill need to change this to always show the name associated with the CustID - and a simple CustomerName doesnt seem to work.

MVP
MVP

Re: Selecting rows with the same attribute

Maybe just add CustomerName as dimension (keeping CustID).

Not applicable

Re: Selecting rows with the same attribute

Yeah I think that should be good enough.

Amazing, youve made my day!.

Not applicable

Re: Selecting rows with the same attribute

I'd like to ask two questions!

1) Can you explain this expression a bit? Im having trouble understanding it (even though it works!)

2) Can I perform the same 'lookup' on another unconnected table? So if I click a Customer, it will show me all my Debtors with the same phone number, for example. Assuming Debtor is a similar table to customer, just a different entity. I'd like to avoid a seperate linking table!

MVP
MVP

Re: Selecting rows with the same attribute

1) How do you think it does work?

2) Should be possible, but you need to use p() function with the Customer table fields as argument, like

=only({<Debitor=p(Customer) >} Debitor)

=only({<DebitorAdress=p(Adress) >} DebitorAdress)

=only({<DebitorPhone=p(Phone) >} DebitorPhone)

Community Browser