You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Data Factory中结合Lookup Activity与Web Activity实现报表

实现方案:Lookup Activity + Web Activity 生成报表并追加现有Web Activity逻辑

1. 配置Lookup Activity获取存储过程数据

  • 在数据工厂中创建Lookup Activity,数据源选择目标数据库,配置调用指定存储过程,确保存储过程返回完整结果集(Lookup默认支持多条记录输出)。
  • Lookup Activity的输出结构示例如下:
{
    "count": 2,
    "value": [
        {
            "Name": "Abc",
            "ActiveRecords": 500,
            "Active": 0
        },
        {
            "Name": "XYZ",
            "ActiveRecords": 300,
            "Active": 200
        }
    ]
}

2. 遍历Lookup结果并传递给Web Activity

由于Lookup返回多条记录,需用ForEach Activity包裹Web Activity实现逐条处理:

  • 添加ForEach Activity,设置Items属性为@activity('你的Lookup活动名称').output.value,替换为实际的Lookup活动名。
  • 在ForEach内部配置Web Activity(或复用现有Web Activity的请求配置),在请求体/URL参数中引用当前遍历的记录:
    • 请求体示例:
    {
        "ReportEntry": {
            "SystemName": "@item().Name",
            "TotalActiveRecords": "@item().ActiveRecords",
            "CurrentActive": "@item().Active"
        }
    }
    
    • URL参数拼接示例:
    @concat('https://你的接口地址?system=', item().Name, '&total=', item().ActiveRecords)
    

3. 追加现有Web Activity的操作逻辑

场景1:现有Web Activity执行完成后触发新流程

将现有Web Activity与新的Lookup+ForEach+Web Activity设置依赖关系:现有Web Activity执行成功后,自动触发Lookup Activity。

场景2:合并现有Web Activity输出与Lookup数据再请求

  • 添加Set Variable Activity,将现有Web Activity的输出存储到变量(如existingWebResult),变量值设为@activity('你的现有Web活动名称').output。
  • 在ForEach内部的Web Activity中,同时引用现有输出与Lookup数据,示例请求体:
{
    "PreviousWebResult": "@variables('existingWebResult')",
    "NewReportData": {
        "SystemName": "@item().Name",
        "TotalActiveRecords": "@item().ActiveRecords",
        "CurrentActive": "@item().Active"
    }
}

4. 验证与调试

  • 运行流水线后,查看Lookup Activity的输出日志,确认是否正确读取存储过程的所有记录。
  • 检查ForEach中Web Activity的请求日志,验证参数/请求体是否正确携带单条记录数据。
  • 确认现有Web Activity的追加逻辑是否按预期执行,数据合并或流程依赖是否生效。

内容的提问来源于stack exchange,提问作者Prasad Sakarkar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.12 20:45:15