Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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!

1 Solution

Accepted Solutions
swuehl
MVP
MVP

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

View solution in original post

6 Replies
swuehl
MVP
MVP

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
Author

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.

swuehl
MVP
MVP

Maybe just add CustomerName as dimension (keeping CustID).

Not applicable
Author

Yeah I think that should be good enough.

Amazing, youve made my day!.

Not applicable
Author

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!

swuehl
MVP
MVP

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)