Aggregate no filter from combo box

Aggregate no filter from combo box

  

Hi All,

I have a combo box with a list of projects. I want to filter by project or not filter if All Projects is selected.
However I am struggling with what my aggregate filter should look like for it to work.


ProjectName is a local variable (text type)


Any ideas?

I have tried a bunch of different combinations nothing seems to work, might be my basic understanding on how this widget works.

Thanks




are you expecting the filter to happen as you select values in the combo box? If so, you will need to handle the On Change and set the destination to be Refresh the aggregate and probably Ajax to refresh the content of where Projects is bound

Hi André,

you only need to set the source attribute to project.name (attribute from the aggregate, that has a project entity and a name attribute). This information (project names) is the one that combo will display, for user to choose from.

However combobox by default, select Ids. Combo Variable stores this ID, so query with this variable should be made with projectId filtering.

You are going on circles getting data from the variable (that doesn't look like an Id) and assigning them again to the variable ProjectName. 

The platform guides you when you create the combo. If you are feeding your combo with an aggregate record list, the source attribute (Project.Name and other AggregateEntities.Attributes) will be suggested by the platform.

I attached a dummy oml for you to see.

Helena Lameiro wrote:

Hi André,

you only need to set the source attribute to project.name (attribute from the aggregate, that has a project entity and a name attribute). This information (project names) is the one that combo will display, for user to choose from.

However combobox by default, select Ids. Combo Variable stores this ID, so query with this variable should be made with projectId filtering.

You are going on circles getting data from the variable (that doesn't look like an Id) and assigning them again to the variable ProjectName. 

The platform guides you when you create the combo. If you are feeding your combo with an aggregate record list, the source attribute (Project.Name and other AggregateEntities.Attributes) will be suggested by the platform.

I attached a dummy oml for you to see.

Helena, Thank you for your OML that really helps, however I have a fundamental issue, when I first designed the application, and probably my lack of foundations to build things properly, my data model is a bit messy.

I did not create a separate entity that stored the projects names (in a common place) so even though I have other entities that refer to the same project names they are not linked by Id (I just have to make sure they are the same, good practice hey... ). The other problem is that I do not want to show all the projects, only the only this user is associated with, so that is why I have a getProjects Aggregate that filters (byUser) and then groups by project so this user only sees his unique project entries in the dropdown. 


The current method I am using works fine, except once I select a specific project and then select all projects again the filters do not work (I have to click reset button, that sets the variables to null), I wonder how I can read if the special list value1 is 0?
This does not seem assigned to the variable, I think this is what is confusing me.



 


Hi André,

Did you try ProjectName = "All Projects" or ...?

Regards,

Marcelo

Solution

Hi Marcelo, Yes I did try that before hand.

So I cracked it, I needed to assign a special variable and then use the value of that special variable (TestSpecial in my example) in an if statement to validate the status of my combo box:

You can see the if statement identifying if the Special Variable is -1 then assign projectname to nullId
My filters remain as per my original post.

 

Thank you all especially Helena for going out of your way to help. 

Solution

Hi André,

I was helping someone with the same problem and '  = ""  ' is working. Check the attachment.

Regards,

Marcelo