Friday, January 27, 2023

HCM - Multi Facet Advance Search Part 2





MetaType Default Value (Text Box)


{ "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": "Text", "FacetType": "Text", "ElasticAggregationsEnabled": false, "ElasticFacetName": "StatusCd", "ToolTip": "Status" } ] }

MetaType Default Value (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 (LOV Multi Select and QParam)

{
    "facetArray": [
        {
            "id": "PlanTypeCd",
            "Default": true,
            "DisplayName": "Plan Type",
            "Type": "Facet",
            "FacetType": "MultiSelectLOV",
            "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"
                }
            ]
        }
    ]
}                                




Possible Facet Types Date
DateRange
CheckBox MultiSelectLOV RadioButton StaticList Text Flag


Date
  id = 'dateId';
             Default = true;
             DisplayName = "Search Dae";
             Type = 'Date';
             ElasticFacetName = 'currentDate';
             ToolTip = "Search Date";
DateRange

          id = 'dateRangeId';
          Default = true;
          DisplayName = "Date Range ";
          Type = 'DateRange';
          ElasticFacetName = "Date Range";
          StartDateToolTip = "Start Date";
          timePeriod.EndDateToolTip = "End Date";



The changed Code Take care of Text Facet

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 ;
/* for a text */
if (a.term){
term = a.term ;
}
if (a.value && a.value.length > 0){
value = "'" + a.value[0] + "'";
}
/* 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 (name == "PlanTypeCd") {
c.PlanTypeCd = value;
}
if (name == "StatusCd") {
c.StatusCd = value;
}

}
}

}

return c;
};


2 comments:

  1. kindly write some paryoll formula where we can calculate basic salary with leave deduction and proration

    ReplyDelete
  2. Hi Tilak, please post on seniority dates fast formula calculation Fast Formula

    ReplyDelete