Dynamically create aggregate

Dynamically create aggregate

  

Is there a way to create/modify aggregate dynamically based on user selection.Below is my scenario:

In my mobile application, i have a Trip creation screen in which User selects Trip Type (Airport-Office or Office-Airport or Office-Office). Based on this Trip Type selection, i have to build an aggregate dynamically in edit trip screen that joins 

  1.  "Trip table - that has TripId,UserId,From (can be airport/office),To (can be airport/office)"
  2. "From table - Can be an airport table or Office Table"
  3. "To table - Can be an airport table or Office Table"

If the Trip Type is Airport - Office or Office - Airport, i can define the aggregate as 

but if the Trip Type is Office-Office 

it should be

                     Trip with or without office locations Trip.From=OfficeLocations.Id

              and Trip with or without office locations Trip.To = OfficeLocations.Id


Can anyone help me achieve the above functionality?


thanks,

-Dileep

Hi Dileep,

Can do you show the entity diagram?

If you have Office-Office maybe you have a problems with Data Type of Trip.To and Trip.From. 

What Data Type do they have? OfficeLocations Identifier? Airport Identifier? Integer?


One option is create more two attributes to Office: Trip.ToOffice (Data Type OfficeLocations Identifier) and Trip.FromOffice (Data Type OfficeLocations Identifier).

Regards!

Paulo Cação wrote:

Hi Dileep,

Can do you show the entity diagram?

If you have Office-Office maybe you have a problems with Data Type of Trip.To and Trip.From. 

What Data Type do they have? OfficeLocations Identifier? Airport Identifier? Integer?


One option is create more two attributes to Office: Trip.ToOffice (Data Type OfficeLocations Identifier) and Trip.FromOffice (Data Type OfficeLocations Identifier).

Regards!

I have given the Data Type for From and To as Integer so they can be used for both Airport/Office Location


Venkata Rajam wrote:

Paulo Cação wrote:

Hi Dileep,

Can do you show the entity diagram?

If you have Office-Office maybe you have a problems with Data Type of Trip.To and Trip.From. 

What Data Type do they have? OfficeLocations Identifier? Airport Identifier? Integer?


One option is create more two attributes to Office: Trip.ToOffice (Data Type OfficeLocations Identifier) and Trip.FromOffice (Data Type OfficeLocations Identifier).

Regards!

I have given the Data Type for From and To as Integer so they can be used for both Airport/Office Location


How do you know which Id is referenced? There will be equals Id's on the Airport and OfficeLocactions.. You will have a problems to know what id is referenced, unless you have a flag to say which type.


Paulo Cação wrote:

Venkata Rajam wrote:

Paulo Cação wrote:

Hi Dileep,

Can do you show the entity diagram?

If you have Office-Office maybe you have a problems with Data Type of Trip.To and Trip.From. 

What Data Type do they have? OfficeLocations Identifier? Airport Identifier? Integer?


One option is create more two attributes to Office: Trip.ToOffice (Data Type OfficeLocations Identifier) and Trip.FromOffice (Data Type OfficeLocations Identifier).

Regards!

I have given the Data Type for From and To as Integer so they can be used for both Airport/Office Location


How do you know which Id is referenced? There will be equals Id's on the Airport and OfficeLocactions.. You will have a problems to know what id is referenced, unless you have a flag to say which type.


I have  a "TripType" attribute in Trip Table that defines if the Trip is from "Airport-Office or Office-Airport or Office-Office". 

I handled the dropdowns on screen to reflect From and To as Airport or Office Locations based on the "TripType" 

Below is my Trip Table

Hi Venkata,

A little suggestion, create a new static entity named TripType.

I suggest you create a Advance query with Case expression. Is a solution, but I believe there are others...


Regards!

Solution

Hi! 

You must have something like this 

Work in the filter to select the correct lines and in the code to select the fields from the correct entity. 

Hope this help . 

Regards 

Graça

Solution

Maria da Graça Peixoto wrote:

Hi! 

You must have something like this 

Work in the filter to select the correct lines and in the code to select the fields from the correct entity. 

Hope this help . 

Regards 

Graça


Thank you,

It worked.

Regards,

-Dileep