Group By Question

Group By Question

  

I have 2 entities in a Agregate. I need to group by one atribute, but as soon as i do it, i can't no longer access the fields on the form.

The only solution i found was to group by every field i need. But i don't want to do it this ways, since not all the fields are unique.

It's there any other way to do it??

Thank you

Hi Diego,

As you concluded, once a group is created all the other fields that don't participate in group or aggregation are hidden in the output. That happens precisely because not all of them will be unique for that particular group.

Is the field you're grouping by editable by the Form as well? What are you using it for?

Regards,

Paulo Ferreira

Paulo Ferreira wrote:

Hi Diego,

As you concluded, once a group is created all the other fields that don't participate in group or aggregation are hidden in the output. That happens precisely because not all of them will be unique for that particular group.

Is the field you're grouping by editable by the Form as well? What are you using it for?

Regards,

Paulo Ferreira

Thank you for the reply Paulo.

No, the field i'm grouping by will not be editable in the form

I have 2 entitis, one is Students and the other is StudensObservations

I'm doing a join "with or without" between Studens and Observations and want to display in the table a checkbox showing if the student have or doesn't have an Observation

To achieve that, i'm doing a count of observations and grouping by StudentId

But now i can't access the rest of the fields (Name, Phone number, etc).

I don't want to group by all the fields, in the case i end up having 2 students with the same name


Solution

Do you need any information from Observations in the output, besides knowing if the Student has observations or not?

If you don't, grouping by Student.Id already ensures that you'll get a unique line for each student, regardless if some students may share the same name, as groups are formed by unique combinations of the grouped attributes.

Regards,

Paulo Ferreira

Solution

Paulo Ferreira wrote:

Do you need any information from Observations in the output, besides knowing if the Student has observations or not?

If you don't, grouping by Student.Id already ensures that you'll get a unique line for each student, regardless if some students may share the same name, as groups are formed by unique combinations of the grouped attributes.

Regards,

Paulo Ferreira

If i understand you correctly.. if i have a table like this:

ID   Name

1    John 

2    Mary

3    Peter

4    John


a Group by ID, and Name will give me the 4 record.. will not join the 2 Johns into 1 single record... 

Am i correct??



Yes, if you group by Id and Name it will still give you the 4 records, since each of them as a distinct Id.

Cheers,

Paulo