UKG 维度请求中的员工人数 (624) 超出允许的限制 (500)

问题描述 投票:0回答:2

当您使用 URL 请求聚合数据时,会发生此错误:

POST - {{DIMENSIONSHOST}}/v1/commons/data/multi_read

我使用的Postman本体是:

{
  "select": [
    {"key": "EMP_COMMON_FULL_NAME"}
  ],
  "from": {
    "view": "EMP",
    "employeeSet": {
        "hyperfind": {
            "id": -9
        },
        "dateRange": {
            "startDate": "2022-01-01",
            "endDate": "2022-04-30"
      }
    }
  },
  "index": 0,
  "count": 500
}

请注意,我请求了“count”:500。尽管我只请求了 500 条记录,但我收到了错误消息,表明记录数超过 500 条。

dimensions
2个回答
0
投票

这确定了 UKG Dimensions 中的错误。我已经开发了一个解决方法:

  1. 使用 /v1/commons/hyperfind/execute 自行检索 hyperfind
  2. 使用 Postman Test(一种后响应程序)将 ID 分成 500 个批次。
  3. 将批次保存到环境变量中
  4. 使用环境变量进行聚合数据请求。

您可以使用以下方法自行检索超级查找:

POST - {{DIMENSIONSHOST}}/v1/commons/hyperfind/execute

请求正文是:

{
    "dateRange": {
        "startDate": "2022-05-01",
        "endDate": "2022-06-30"
    },
    "hyperfind": {
        "id": -9
    },
    "includeTerminatedInRangeForLocations": true
}

测试脚本是:

var jsonData = JSON.parse(responseBody); //the data from the response body
var allIDs = [];  //an array of all the IDs, no record count limit
var max500IDs = []; //arrays of maximum number of IDs
//
//retrieve all the IDs and put them into an array called allIDs
//
for(var i = 0; i < jsonData.result.refs.length; i++) {
    allIDs.push(jsonData.result.refs[i].id );
}
var batchCount = 1; //number of batches - default 1
var IDsInBatch = 500;  //maximum number of records in batch
//
//calculate the number of batches that you will need
//
if(allIDs.length > IDsInBatch) {
    batchCount = Math.ceil((allIDs.length - 1) / IDsInBatch);
}
//
//loop through the number of batches
//
var eeCountInOtherBatches = 0;
for(var k = 0; k < batchCount; k++) {
    //
    //loop through all the IDs and transfer them to a max 500 batch
    //
    var batch = []
    for(var j = 0; j < IDsInBatch; j++) {
        personID = allIDs[eeCountInOtherBatches + j];
        if(personID) {
            batch.push(personID);
        }
    }
    max500IDs[k] = batch;
    eeCountInOtherBatches = eeCountInOtherBatches + IDsInBatch;
}
//
//transfer the batches to environment variable(s)
//
for(var x = 0; x < max500IDs.length; x++) {
    postman.setEnvironmentVariable("max500IDs_" + x, max500IDs[x]);
}

环境变量将是:

max500IDs_0
max500IDs_1
etc.

员工的要求类似于:

POST - {{DIMENSIONSHOST}}/v1/commons/data/multi_read

身体将是:

{
  "select": [
    {"key": "EMP_COMMON_FULL_NAME"}
  ],
  "from": {
    "view": "EMP",
    "employeeSet": {
        "employees": {
            "ids": [{{max500IDs_0}}]
        },
        "dateRange": {
            "startDate": "2022-01-01",
            "endDate": "2022-04-30"
      }
    }
  },
  "index": 0,
  "count": 500
}

0
投票

非常感谢道格拉斯提供的解决方法。 如果我们使用 hyperfind/execute 获取员工 ID,我可以获得一些所需的术语员工 ID。但是,当我可以进行 data/multi_read 时,它们将被拒绝。 数据视图如何显示所谓的员工?

非常感谢您的帮助。

最诚挚的问候, 约瑟夫·唐

© www.soinside.com 2019 - 2024. All rights reserved.