719
Views
6
Comments
Solved
How to set the listbox 'Selection Attribute' when the source aggregate has one column
Question

The documentation says to add a boolean but I can't seem to do that to an aggregate that has one column which is the single group by of one column.  My aggregate is over a table that has many different cities. I would normally in SQL do a select distinct but I am doing a group by of just the city to get a list of cities. I want to be able to allow multiple selection of different cities but don't know what this selection Attribute has. The docs say to add a boolean attribute but I can't seem to do that to an aggregate that has a single group by column.

Thanks

mvp_badge
MVP
Rank: #15
Solution

Hi Bradford,

You will need to create another list of records with the same columns of the aggregate plus the one for the selected. and assign the aggregate to that list.

Regards,

Marcelo


Rank: #14573

Marcelo, Thank you for your response.

Allow me to clarify what I had to do for your verification.

Added a New Entity with matching field type of the unique code from my aggregate and a boolean named Selected.
Added a local variable of the new entity type.
Added an assign after the aggregate that assigned the aggregate list to the local variable and verified the Mapping was correct for the one unique field.
Added a ListBox and set the source to the new local variable.
This allowed me to be able to set the Selection Attribute to the the additional feild in the new entity.

Thanks again.

mvp_badge
MVP
Rank: #15

Hi Bradford,

You don't need to add a new entity. You can use a structure. 

The rest looks fine.

Regards,

Marcelo

Rank: #14081

Hello,


Once I do that, would the boolean change to true when I select that entry? If so, how do I do that? Is it on the OnChange?


Thank you.

mvp_badge
MVP
Rank: #15

Hi Vinicius,

You don't need to do nothing. The listBox will do it for you. to check the ones that are select just use the listbox list and the field that you assign has "selection attribute" will be true or false depend if you select that item or not.

Regards,

Marcelo

Rank: #3401

Hi,

being this topic already solved, I would like to leave just a note for discussion. I was implementing the same thing and checked forums to check if people though of different solution from mine.
Because you can't group by a literal, to achive that, you need to name the literal, wrap it in another Select and group by that column name, which aggregates doesn't do, so they have the condition that you can't group by that literal.

To achive the goal of having an attribute in the aggregate which is always the same on Preparation and can still use the aggregate in the screen (because it's simpler and cleaner) what I usually do is:

  1. Create a new attribute on the aggregate
  2. Assign something like Entity.Id <> Entity.ID (the point here is to make an assertion which is always false) and name it IsSelected
  3. Group by the values I need + this attribute IsSelected


Regards,

João Franco