cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Project Oakdale - Filter combo box records based on their choice value

I have a combo box, the data source is a table in Project Oakdale that holds buildings. I would like to filter the drop down to only show buildings that have a status(choice column) of "Available". I seem to get an error using the following:

Tristan_Falcon_1-1601435078179.png

Not sure if my filter is wrong or if Project Oakdale has a bug?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Hi @Tristan_Falcon :

In Project Oakdale, Choice belongs to a special data type (similar to Option in CDS entity). Usually this type of field can not be directly calculated.

I have three methods for your reference.

Solution1:Refers to the value of'Status' in a record in the table(Do this to ensure that the data types are the same)

For example:

 

Filter(LeaseBuildings,'Status (cr3db_status)'=First([@LeaseBuildings]).'Status (cr3db_status)')

 

Solution2:Using Choices([@LeaseBuildings].'Status (cr3db_status)')

For example

 

Filter(LeaseBuildings,'Status (cr3db_status)'=First(Choices([@LeaseBuildings].'Status (cr3db_status)')).Value)

 

The fatal disadvantage of these two solutions is the lack of flexibility. You need to pre-determine that the status of the record/option you use as the filter criteria is ‘Available’.

Solution3:Using a combo box control

1\Add a combo box control(Microsoft_CoreControls_ComboBox1) and set it's items property to 

 

Choices(LeaseBuildings.'Status (cr3db_status)')

 

2\Try this code:

 

Filter(LeaseBuildings,'Status (cr3db_status)'=Microsoft_CoreControls_ComboBox1.Selected.Value)

 

Best Regards,

Bof

View solution in original post

4 REPLIES 4
Highlighted
Community Support
Community Support

Hi @Tristan_Falcon :

In Project Oakdale, Choice belongs to a special data type (similar to Option in CDS entity). Usually this type of field can not be directly calculated.

I have three methods for your reference.

Solution1:Refers to the value of'Status' in a record in the table(Do this to ensure that the data types are the same)

For example:

 

Filter(LeaseBuildings,'Status (cr3db_status)'=First([@LeaseBuildings]).'Status (cr3db_status)')

 

Solution2:Using Choices([@LeaseBuildings].'Status (cr3db_status)')

For example

 

Filter(LeaseBuildings,'Status (cr3db_status)'=First(Choices([@LeaseBuildings].'Status (cr3db_status)')).Value)

 

The fatal disadvantage of these two solutions is the lack of flexibility. You need to pre-determine that the status of the record/option you use as the filter criteria is ‘Available’.

Solution3:Using a combo box control

1\Add a combo box control(Microsoft_CoreControls_ComboBox1) and set it's items property to 

 

Choices(LeaseBuildings.'Status (cr3db_status)')

 

2\Try this code:

 

Filter(LeaseBuildings,'Status (cr3db_status)'=Microsoft_CoreControls_ComboBox1.Selected.Value)

 

Best Regards,

Bof

View solution in original post

Highlighted

Thanks @v-bofeng-msft I'll keep these options in mind.
I ended up creating a custom view on the LeaseBuilding entity that has the necessary filter.

Highlighted

Hi @Tristan_Falcon :

Is there anything else I can help?
If my post helps, then please consider Accept it as the solution to help others.Thanks.

Best Regards,

Bof

 

Highlighted

Hey there, just accepted the solution.
Sorry, still a bit new around here... haha

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (12,901)