我有一个查找,我正在执行查询以获取
employee_no
SELECT employee_no FROM HRS.EMPLOYEE_MASTER WHERE SOC_SEC_NO = '@{variables('FE_SoSecNo')}'
这可能会返回如下数据
{
"firstRow": {
"EMPLOYEE_NO": "12345"
},
"effectiveIntegrationRuntime": "VMSHIntegrationRuntime",
"billingReference": {
"activityType": "PipelineActivity",
"billableDuration": [
{
"meterType": "SelfhostedIR",
"duration": 0.016666666666666666,
"unit": "Hours"
}
],
"totalBillableDuration": [
{
"meterType": "SelfhostedIR",
"duration": 0.016666666666666666,
"unit": "Hours"
}
]
},
"durationInQueue": {
"integrationRuntimeQueue": 3
}
}
或者如果没有找到数据
{
"effectiveIntegrationRuntime": "VMSHIntegrationRuntime",
"billingReference": {
"activityType": "PipelineActivity",
"billableDuration": [
{
"meterType": "SelfhostedIR",
"duration": 0.016666666666666666,
"unit": "Hours"
}
],
"totalBillableDuration": [
{
"meterType": "SelfhostedIR",
"duration": 0.016666666666666666,
"unit": "Hours"
}
]
},
"durationInQueue": {
"integrationRuntimeQueue": 3
}
}
我添加了一个步骤来读取值,如下所示,但是当 json 节点不存在时,如果节点值不存在,我尝试插入什么并通过获取值进行更新
activity('GetEmpBySSN').output.firstRow.employee_no
我可以知道如何编写读取值的逻辑吗
我创建了一个布尔变量来检查查找的响应是否包含
firstrow
节点,我用来检查属性是否存在的表达式是 this
@bool(contains(activity('Lookup1').output, 'firstRow'))
我的布尔变量:
设置变量:
输出:
然后,您可以在 If 活动中使用该布尔变量,以根据变量的值有条件地获取节点的值(如果它存在)。