Thursday, January 26, 2023

HCM - Multi Facet Advance Search

 HCM - Multi Facet Advance Search 


Type


"types": {

"facetType": {
"Default": "boolean",
"DisplayAttribute": "string",
"DisplayName": "string",
"ElasticAggregationsEnabled": "boolean",
"ElasticFacetName": "string",
"EndEndDateolTip": "string",
"Endpoint": "string",
"FacetType": "string",
"Finder": "string",
"Group": "string",
"GroupLabel": "string",
"id": "string",
"KeyAttribute": "string",
"labelMapping": [
{
"disabled": "boolean",
"label": "string",
"value": "string"
}
],
"QParam": "string",
"StartEndDateolTip": "string",
"ToolTip": "string",
"Type": "string"

},
"searchMetaDataType": {
"facetArray": "facetType[]",
"keywordSearchFieldsArray": "string[]",
"securityFilters": "object"
}

},


MetaType Default Value (Static Lookup)

{
"facetArray": [
{
"id": "PlanTypeCd",
"Default": true,
"DisplayName": "Plan Type",
"Type": "Facet",
"FacetType": "StaticList",
"ElasticAggregationsEnabled": false,
"ElasticFacetName": "PlanTypeCd",
"labelMapping": [
{
"label": "Plan Type A",
"value": "A"
},
{
"label": "Plan Type Q",
"value": "Q"
},
{
"label": "Plan Type N",
"value": "N"
}
]
},
{
"id": "StatusCd",
"Default": true,
"DisplayName": "Plan Status",
"Type": "Facet",
"FacetType": "StaticList",
"ElasticAggregationsEnabled": false,
"ElasticFacetName": "StatusCd",
"labelMapping": [
{
"label": "Active",
"value": "A"
},
{
"label": "In Progress",
"value": "I"
}
]
}
]
}


Meta Data Default (Check Box and Multi Select)

{ "facetArray": [ { "id": "PlanTypeCd", "Default": true, "DisplayName": "Plan Type", "Type": "Facet", "FacetType": "CheckBox", "ElasticAggregationsEnabled": false, "ElasticFacetName": "PlanTypeCd", "KeyAttribute": "LookupCode", "DisplayAttribute": "Meaning", "Endpoint": "oracle_hcm_compensationworkforcesetupUI:commonLookupsLOV/getall_commonLookupsLOV", "Finder": "LookupTypeFinder;LookupType=CMP_MD_STATUS", "Fields": "LookupCode,Meaning", "OrderBy":"Meaning" }, { "id": "StatusCd", "Default": true, "DisplayName": "Plan Status", "Type": "Facet", "FacetType": "StaticList", "ElasticAggregationsEnabled": false, "ElasticFacetName": "StatusCd", "labelMapping": [ { "label": "Active", "value": "A" }, { "label": "In Progress", "value": "I" } ] } ] }

Meta Data Default (Check Box and Multi Select and QParam)

{
    "facetArray": [
        {
            "id": "PlanTypeCd",
            "Default": true,
            "DisplayName": "Plan Type",
            "Type": "Facet",
            "FacetType": "CheckBox",
            "ElasticAggregationsEnabled": false,
            "ElasticFacetName": "PlanTypeCd",
            "KeyAttribute": "LookupCode",
            "DisplayAttribute": "Meaning",
            "Endpoint": "oracle_hcm_compensationworkforcesetupUI:commonLookupsLOV/getall_commonLookupsLOV",
            "Finder": "LookupTypeFinder;LookupType=ORA_HRX_GB_CSP_SCHCAT",
            "Fields": "LookupCode,Meaning",
            "QParam": "LookupCode IN ('A', 'Q', 'N', 'C' )",
            "OrderBy":"Meaning"
        },
        {
            "id": "StatusCd",
            "Default": true,
            "DisplayName": "Plan Status",
            "Type": "Facet",
            "FacetType": "StaticList",
            "ElasticAggregationsEnabled": false,
            "ElasticFacetName": "StatusCd",
            "labelMapping": [
                {
                    "label": "Active",
                    "value": "A"
                },
                {
                    "label": "In Progress",
                    "value": "I"
                }
            ]
        }
    ]
}                                


Function to Get the Values From Search
(attached in Search Submit)
seatchObject <- $event.detail


PageModule.prototype.getSearchObject = function (searchObject) {

//Deleting as its not supported in rest input payload
delete searchObject.securityFilters;
//The below searchFieldsArray is not necessary if the query is null. This has been added since teh REST been used in this example is not working fine without this. Hence added.
if (!(searchObject && searchObject.query)) {
searchObject.query = '';
}

if (!(searchObject && searchObject.limit)) {
searchObject.limit = 25;
}


var c = {};
c.PlanTypeCd = '';
c.StatusCd = '';
c.PlanName = '%' + searchObject.query + '%';

if (searchObject) {
if (searchObject.filters && searchObject.filters.length > 0) {
for (var i = 0; i < searchObject.filters.length; ++i) {
var a = searchObject.filters[i];
let value = '';
let name = a.name[0];
let term = a.terms ;
if (a.value && a.value.length > 0){
value = "'" + a.value[0] + "'";
}
if (name == "PlanTypeCd") {
/* when type has checkbox-multi select */
if (term && term.length > 0){
for (var k = 0; k < term.length; ++k) {
let condValue = term[k]
value += ( value? ",": "")+ "'"+ condValue +"'";
}
}

if (value){
c.PlanTypeCd = value;
}
}
if (name == "StatusCd") {
c.StatusCd = value;
}

}
}

}

return c;
};


Possible Facet Types Date CheckBox MultiSelectLOV RadioButton StaticList Text Flag



Sample Q Parameter

"PlanName LIKE '" + $page.variables.searchPlanName + "'" + ( $page.variables.searchPlanType? " AND PlanTypeCd IN ( "+ $page.variables.searchPlanType + ")" : '') + ( $page.variables.SearchPlanStatus? " AND StatusCd="+$page.variables.SearchPlanStatus : '' )

1 comment:

  1. Hi sir thanks for this. but i don't have access to HCM component in Smart Search Filter component. I have only Smart Search Component and i couldn't achieve it. It will be good if you post a video for Smart Search Component Faceted Chips or Search

    ReplyDelete