cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
fs92
Level: Powered On

How to use filter and search in PCF for React

Hi,

I want to use the filter and search function in my react app for a model driven powerapp with PCF.

The documentation describes not how to use it in javascript correctly. Has someone information about this?

Do I have to import some additional React components?

 

Here is a description of filtering but there is no example or full description on how to use it:

https://docs.microsoft.com/en-us/powerapps/developer/component-framework/reference/filtering

 

Best regards

1 ACCEPTED SOLUTION

Accepted Solutions
ScottDurow
Level 8

Re: How to use filter and search in PCF for React

There really isn't any difference using this in React or not - the setFilter accepts a FilterExpression https://docs.microsoft.com/en-us/powerapps/developer/component-framework/reference/filterexpression

 

You can use as follows:

const expression = {
  name: "account",
  from: "accountid",
  to: "parentcustomerid",
  linkType: "inner",
  alias: "parentaccount ",
};

_context.parameters.sampleDataset.linking.addLinkedEntity(expression);
const condition = {
  attributeName: "accountid",
  conditionOperator: 79, // Equal or Under
  value: _context.page.entityId,
  entityAliasName: "parentaccount",
};
const conditionArray = [];
conditionArray.push(condition);
_context.parameters.sampleDataset.filtering.setFilter({
  conditions: conditionArray,
  filterOperator: 1, // Or
});
_context.parameters.sampleDataset.refresh();

Hope this helps

View solution in original post

3 REPLIES 3
ScottDurow
Level 8

Re: How to use filter and search in PCF for React

There really isn't any difference using this in React or not - the setFilter accepts a FilterExpression https://docs.microsoft.com/en-us/powerapps/developer/component-framework/reference/filterexpression

 

You can use as follows:

const expression = {
  name: "account",
  from: "accountid",
  to: "parentcustomerid",
  linkType: "inner",
  alias: "parentaccount ",
};

_context.parameters.sampleDataset.linking.addLinkedEntity(expression);
const condition = {
  attributeName: "accountid",
  conditionOperator: 79, // Equal or Under
  value: _context.page.entityId,
  entityAliasName: "parentaccount",
};
const conditionArray = [];
conditionArray.push(condition);
_context.parameters.sampleDataset.filtering.setFilter({
  conditions: conditionArray,
  filterOperator: 1, // Or
});
_context.parameters.sampleDataset.refresh();

Hope this helps

View solution in original post

fs92
Level: Powered On

Re: How to use filter and search in PCF for React

Thanks for your reply.
Is there another documentation or guides on how to use filters and conditions? The documentation on the PCF site isn’t good currently
ScottDurow
Level 8

Re: How to use filter and search in PCF for React

I believe that more documentation is in the works!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 149 members 5,313 guests
Recent signins:
Please welcome our newest community members: