cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Tristan_Falcon
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
v-bofeng-msft
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
v-bofeng-msft
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

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.

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

 

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

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (20,718)