There are several ways to use getReplicatedFieldsWithAdvancedProps. For example, you can display a list of replicated datasets and the filtered fields for each replicated dataset.
This example adds a Get button to a page with replicated datasets. The page must contain form elements for the information required to filter the fields for the replicated dataset, like
the advanced properties names and values, and a list of fields to filter. Filtering the fields for a replicated dataset displays a toast message using the
lightning/platformShowToastEvent module.
1import{LightningElement, api}from 'lwc';2import{getReplicatedFieldsWithAdvancedProps}from 'lightning/analyticsWaveApi';3import{ShowToastEvent}from 'lightning/platformShowToastEvent';45export default class GetReplicatedFieldsWithAdvancedProps extends LightningElement{6 @api rdId; // or fetch the ID of the replicated dataset7 sourceObjectData = {8 "advancedProperties" :[9{"name": "filterProp1", value: "filterValue1"},10{"name": "filterProp2", value: "filterValue2"}11]12 "sourceObjectFields" : ["Field1", "Field2", "Field3"]13};1415 get(event){16 getReplicatedFieldsWithAdvancedProps({id: this.rdId, sourceObjectData : this.sourceObjectData})17 .then(()=>{18 this.dispatchEvent(19 new ShowToastEvent({20 title: 'Success',21 message: 'Replicated dataset fields filtered',22 variant: 'success'23})24);25})26 .catch(error =>{27 this.dispatchEvent(28 new ShowToastEvent({29 title: 'Error filtering replicated dataset fields',30 message: error.body.message,31 variant: 'error'32})33);34});35}36}
This button calls the getReplicatedFieldsWithAdvancedProps() method.