简体   繁体   English

如何在 Azure 数据工厂中使用特殊字符访问查找活动结果?

[英]How to access a look up activity result with special chars in Azure Data factory?

I need to get a attribute with the total number of pages that an API returns so I can control the loop to get all pages.我需要获取一个包含 API 返回的总页数的属性,以便我可以控制循环以获取所有页面。 It's small so I created a LookUp activity I must inside a JSON file but the Field names have special chars on it (":") so I have fields like "soapenv:Envelope".它很小,所以我创建了一个查找活动,我必须在 JSON 文件中,但字段名称上有特殊字符(“:”),所以我有像“soapenv:Envelope”这样的字段。 Code like this will not work:这样的代码将不起作用:

@activity('LookupTest').output.value[0].value.soapenv:Envelope.soapenv:Header.hdr:paginacao.hdr:totalPaginas

It Bring me an error.它给我带来了一个错误。

{"code":"BadRequest","message":null,"target":"pipeline//runid/28573e28-b5ef-41a6-9f8d-2655696193e1","details":null,"error":null}

How can I access it?我怎样才能访问它?

The output of LookUp Activity:查找活动的 output:

{
    "count": 1,
    "value": [
        {
            "soapenv:Envelope": {
                "soapenv:Header": {
                    "mh:messageHeader": {
                        "mh:codigoPerfilAgente": 3801,
                        "mh:transactionId": "d6080aa1-80c2-4743-85e3-a6550a22adda"
                    },
                    "hdr:paginacao": {
                        "hdr:numero": 2,
                        "hdr:quantidadeItens": 30,
                        "hdr:totalPaginas": 2,
                        "hdr:quantidadeTotalItens": 48
                    }
                },
                "soapenv:Body": {
...

I managed to solve converting to string replacing the ":" to "_":我设法解决了转换为将“:”替换为“_”的字符串:

@string(json(replace(replace(string(activity('LookupTest').output.value[0]), 'soapenv:', 'soapenv_'), 'hdr:', 'hdr_')).soapenv_Envelope.soapenv_Header.hdr_paginacao.hdr_totalPaginas)

Does anyone have a more elegant solution?有没有人有更优雅的解决方案?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM