Display rows where condition

  

Hello,


in my application, the table "contacts" has 3 types: emergency, internal, external.

i want to display each type of contact as a separate table. How can i do that?

In SQL my query would use "where contact_type = "insert type here" ", but i don't know how to do that using outsystems. Any help would be great!

thank you in advance!

Hi Basma,

You need to use 3 Table record widget and need to use 3 aggregates for emergency, internal, external contact types in preparation and use these aggregates as source record in respective tables.

Example: For first aggregate(GetInternalContactType) Contact_Type_Id=Entities.Contact_Type.internal and use this aggregate for Internal Table record and do the same for remaining 2 table records.


Thanks

-SK-

Shashi kant Shukla wrote:

Hi Basma,

You need to use 3 Table record widget and need to use 3 aggregates for emergency, internal, external contact types in preparation and use these aggregates as source record in respective tables.

Example: For first aggregate(GetInternalContactType) Contact_Type_Id=Entities.Contact_Type.internal and use this aggregate for Internal Table record and do the same for remaining 2 table records.


Thanks

-SK-

I tried this, it doesn't seem to work. I create 3 aggregates the way you specified, but it still doesnt work.


Basma El Moadadi wrote:

Shashi kant Shukla wrote:

Hi Basma,

You need to use 3 Table record widget and need to use 3 aggregates for emergency, internal, external contact types in preparation and use these aggregates as source record in respective tables.

Example: For first aggregate(GetInternalContactType) Contact_Type_Id=Entities.Contact_Type.internal and use this aggregate for Internal Table record and do the same for remaining 2 table records.


Thanks

-SK-

I tried this, it doesn't seem to work. I create 3 aggregates the way you specified, but it still doesnt work.



If you can share your oml then I can definitely help you.


Shashi kant Shukla wrote:

Basma El Moadadi wrote:

Shashi kant Shukla wrote:

Hi Basma,

You need to use 3 Table record widget and need to use 3 aggregates for emergency, internal, external contact types in preparation and use these aggregates as source record in respective tables.

Example: For first aggregate(GetInternalContactType) Contact_Type_Id=Entities.Contact_Type.internal and use this aggregate for Internal Table record and do the same for remaining 2 table records.


Thanks

-SK-

I tried this, it doesn't seem to work. I create 3 aggregates the way you specified, but it still doesnt work.



If you can share your oml then I can definitely help you.



Hello, 

If the information that you want to show is the same for the 3 Contact types, I would advice you to use a webblock, with an input with the type of Contact that you want to show. Inside the webblock, you have all the information that you need to show.

In that way, the query is only one and changed by the Contact type and, in that way, you maintain the same functionality as equal as the number of types that you have. If in another place, you want to show again the contacts, it's just a metter of moving the webblock to that area.


Kind regards

Hi Basma,

As Miguel has explained you can also use webblock to achieve the required functionality.


Thanks

-SK-


Miguel Sousa wrote:

Shashi kant Shukla wrote:

Basma El Moadadi wrote:

Shashi kant Shukla wrote:

Hi Basma,

You need to use 3 Table record widget and need to use 3 aggregates for emergency, internal, external contact types in preparation and use these aggregates as source record in respective tables.

Example: For first aggregate(GetInternalContactType) Contact_Type_Id=Entities.Contact_Type.internal and use this aggregate for Internal Table record and do the same for remaining 2 table records.


Thanks

-SK-

I tried this, it doesn't seem to work. I create 3 aggregates the way you specified, but it still doesnt work.



If you can share your oml then I can definitely help you.



Hello, 

If the information that you want to show is the same for the 3 Contact types, I would advice you to use a webblock, with an input with the type of Contact that you want to show. Inside the webblock, you have all the information that you need to show.

In that way, the query is only one and changed by the Contact type and, in that way, you maintain the same functionality as equal as the number of types that you have. If in another place, you want to show again the contacts, it's just a metter of moving the webblock to that area.


Kind regards

Do i create an input inside the webblock?


Basma El Moadadi wrote:

Miguel Sousa wrote:

Shashi kant Shukla wrote:

Basma El Moadadi wrote:

Shashi kant Shukla wrote:

Hi Basma,

You need to use 3 Table record widget and need to use 3 aggregates for emergency, internal, external contact types in preparation and use these aggregates as source record in respective tables.

Example: For first aggregate(GetInternalContactType) Contact_Type_Id=Entities.Contact_Type.internal and use this aggregate for Internal Table record and do the same for remaining 2 table records.


Thanks

-SK-

I tried this, it doesn't seem to work. I create 3 aggregates the way you specified, but it still doesnt work.



If you can share your oml then I can definitely help you.



Hello, 

If the information that you want to show is the same for the 3 Contact types, I would advice you to use a webblock, with an input with the type of Contact that you want to show. Inside the webblock, you have all the information that you need to show.

In that way, the query is only one and changed by the Contact type and, in that way, you maintain the same functionality as equal as the number of types that you have. If in another place, you want to show again the contacts, it's just a metter of moving the webblock to that area.


Kind regards

Do i create an input inside the webblock?


Yes you need to create Input Parameter Contact_Type



Hi Basma EI,

Please find sample OML.

-HM-

First, everyone, please stop quoting all the previous posts when replying. This creates unnecessary lengthy posts and is difficult to read.

That said, Basma, I'm going back to your original question. You say you have a single Contact Entity, with three functional types. I assume these types are defined in a Static Entity (e.g. ContactType), and the Contact Entity has a ContactTypeId?

You want three TableRecords on screen, each containing a single contact type. Therefore, you need three queries. I assume that you can use Aggregates for that (that is, you don't need fancy stuff like sub-queries or the like). So create an Aggregate by drag/dropping the Contact Entity on the canvas. Next, go to the Filters tab, and click "Add Filter". This will open the Filter Condition pop-up.

In the pop-up, select the Attribute to filter on, by expanding the Contact Entity, and selecting the ContactTypeId. Double click it, so it automatically appears in the editor. Next, press the "equal to" button or type = yourself. Then, select from the tree control "Entities", then ContactType, then the value you need (e.g. Emergency). Alternatively, you can type Entites.ContactType.Emergency yourself.

That's it. Now your aggregate filters on a single contact type. Now copy/paste the Aggregate two times, and change the Filters to match the desired contact types. Don't forget to name the Aggregates appropriately (e.g. GetContactEmergency etc.).

Hitesh Maran wrote:

Hi Basma EI,

Please find sample OML.

-HM-


Hi Hitesh,

The sample is not working, i created separate users with different types but they were displayed in the same table.

I followed your instructions, however, the tables this time are displaying no records at all...

here are the filters i made.. any help?

hi Basma

The Filters has logical AND that's why you got no record displayed: TRUE AND FALSE AND FALSE evaluates FALSE. You should create three aggregates with each filter - Emergency, Internal, and External. Create also three TableRecords with SourceRecordList the corresponding aggregates.

regards,

IB


I Box wrote:

hi Basma

The Filters has logical AND that's why you got no record displayed: TRUE AND FALSE AND FALSE evaluates FALSE. You should create three aggregates with each filter - Emergency, Internal, and External. Create also three TableRecords with SourceRecordList the corresponding aggregates.

regards,

IB


Hey,

i did create 3 aggregates with each filter. 

However, the filters are not shown when i want to choose the source of the record list. 


Solution

Hi Basma,

Please find attached oml it is working.

Below are required output:

Solution

hi Basma,

Here we go...

Given:

where 

- static entity contracttype:

- entity contract:

Note: to create screen insert and list.. u can scaffolding the Entity Contract by right click mouse and choose Click List Screen and Click Detail Screen.

Find:


Cook Book:

1. In Preparation Action of A Web Screen (say WSContracts):

where:

Aggregate GetContractEmergency has filter(s):

and also the rest two, Internal and External sequencely:

Note: to show the filter, just double click the aggregate and click the icon menu Filter:

2. Put 3 TableRecords in WSContracts:


3. Assign each SourceRecordList of the TableRecord with corresponding aggregate:


 3. Try It

regards,

IB

thank you so much! I solved it and my steps were similar to the one you wrote!