Friday, May 12, 2023

Orcle VBCS Codes

 

Oracle VBCS Code 



Exporting VBCS table to XL Shhet

define(['xlsx'], function(XLSX) {
'use strict';

class PageModule {
}

PageModule.prototype.downloadXLS = function (sdp){
var elt = document.getElementById(sdp);
var wb = XLSX.utils.table_to_book(elt, { sheet: "sheet1" });
return XLSX.writeFile(wb, 'MySheetName.xlsx');

}

return PageModule;
});

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;
};


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 : '' )