cancel
Showing results for 
Search instead for 
Did you mean: 

Filter table based on the value selected in another table

Former Member
0 Kudos

Hello Experts,

I have 2 tables - Countries(with a single column - Country) and Cities(with a single column - City).

I have a DataService which is returning all Countires with all Cities as country-city pairs.

What I want to archive is when a selection made in Countries table (also multiple selection possible), than Cities table is filtered just to the cities belonging to countries selected.

How do I do that in VC without hitting DataService every time country is selected (as all data is already available during a single call)? Maybe first store data to DataShare element and than somehow trigger filtering based on the country selection, but than how do I pass countries selected to a filter?

Thanks for your answers!

Best Regards,

Artsiom Anichenka

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I have found solution myself. If anyone interested, here I have descibed solution in this post:

http://forums.sdn.sap.com/email!default.jspa?messageID=11061570

Former Member
0 Kudos

Hi

I'm interested to your solution ... could you give me more details?

Regards, Roberto

Former Member
0 Kudos

Hello Roberto,

here is the description from the link in my previous post:

on design board I have:

- Table with with userIDs (DataStore is connected to this table via select event, so currently selected user is always stored)

- DataShare with all the user-role pairs

- out port of DataShare is connected to a Filter (where the filtering is done based on UserID stored in DataStore, described above)

- out port of the Filter is connected to Table where the roles of the selected user need to be displayed

What I need is when the user is selected in the first table, it's roles should be displayed in second table. I can achieve it with adding a button to first table with custom action and than specifing this action on the connection between DataShare and Filter.

just replace user-roles with countries-cities.

The main trick here is that the Filter is executing with a custom action which is fired with a button click.

Please let me know if it now clear to you.

Former Member
0 Kudos

Hello Artsiom,

thank you for the details. One question: do you know if is it possible to specify a formula into the filter operator?

I mean: from the output of the data service I defined a filter before to show all the rows in a table. And I'd like to filter all the data through a variable called "Channel". To filter these data I'd like to have a filter with the following formula IF(STORE@Channel=='B2B', B2B, B2C).

Usually in a filter there are predefined conditions like Equal "Text" or Starts with "Text" but I'm not able to specify a complex formula. Do you know if is it possible?

Regards, Roberto

Former Member
0 Kudos

Hello Roberto,

yes it is possible, just in a filter settings in a first column (where you are defining field you are filtering on) select Define Expression option and write a complex condition.

Best Regards,

Artsiom Anichenka

Former Member
0 Kudos

Hi,

this is incredible because I'm no able to see this kind of option ... I see only fields and I'm not able to choose an expression. If you want I can send an image of this. And I don't understand what's happening.

Roberto