Forms Canvas PowerApp表单无法从自定义连接器获取字段,该连接器从REST API返回表格数据

Forms Canvas PowerApp表单无法从自定义连接器获取字段,该连接器从REST API返回表格数据,forms,canvas,powerapps,connector,Forms,Canvas,Powerapps,Connector,我创建了restapi的自定义连接器,它返回表格数据。我在canvas powerapp中将其用作数据源,它将来自自定义连接器的记录存储到集合中。此集合被成功显示每个项目的项目和属性的库用作数据源。但是,当我尝试使用集合作为数据源时,它无法访问字段。直接使用自定义连接器作为数据源也不起作用 在@aorphan的文章中,我了解到,您可以在表单中使用自定义连接器,只要它们返回表,而不是操作。据我所知,收集的内容是表格数据: 甚至集合的列也可以作为Gallery显示的项目的属性进行访问: 但是,即

我创建了restapi的自定义连接器,它返回表格数据。我在canvas powerapp中将其用作数据源,它将来自自定义连接器的记录存储到集合中。此集合被成功显示每个项目的项目和属性的库用作数据源。但是,当我尝试使用集合作为数据源时,它无法访问字段。直接使用自定义连接器作为数据源也不起作用

在@aorphan的文章中,我了解到,您可以在表单中使用自定义连接器,只要它们返回,而不是操作。据我所知,收集的内容是表格数据:

甚至集合的列也可以作为Gallery显示的项目的属性进行访问:

但是,即使将集合设置为新编辑表单的数据源,也无法从数据源添加任何字段:

为了防止我的数据需要更丰富的定义才能被表单正确解释,我的API返回的JSON如下所示:

    {
        "quotes": [
            {
                "quote_pk": 347,
                "shipment_name": "test add leg",
                "organization_ff_name": "LIFE",
                "quote_id": "1234",
                "effective_until": "2020-05-10",
                "eta": "2020-05-14T12:00:00Z",
                "price": 100.0,
                "quote_status": 2
            },
            {
                "quote_pk": 345,
                "shipment_name": "test modal review",
                "organization_ff_name": "LIFE",
                "quote_id": "123",
                "effective_until": "2020-05-11",
                "eta": "2020-05-22T12:00:00Z",
                "price": 1749.94,
                "quote_status": 6
            }
        ]
    }
swagger: '2.0'
info: {title: some title, description: some description, version: '1.0'}
host: server.domain.com
basePath: /organizations/endpoint/
schemes: [https]
consumes: []
produces: []
paths:
  /organizations/endpoint/shipment_quotes/: {}
  /shipment_quotes/:
    get:
      responses:
        '200':
          description: default
          schema:
            type: object
            properties:
              quotes:
                type: array
                items:
                  type: object
                  properties:
                    quote_pk: {type: integer, format: int32, description: quote_pk}
                    shipment_name: {type: string, description: shipment_name}
                    organization_ff_name: {type: string, description: organization_ff_name}
                    quote_id: {type: string, description: quote_id}
                    effective_until: {type: string, description: effective_until}
                    eta: {type: string, description: eta}
                    price: {type: number, format: float, description: price}
                    quote_status: {type: integer, format: int32, description: quote_status}
                description: quotes
      summary: peration summary
      description: operation description
      operationId: operationId
      parameters:
      - {name: Content-Type, in: header, required: false, type: string}
      - {name: Accept, in: header, required: false, type: string}
definitions: {}
parameters: {}
responses: {}
securityDefinitions: {}
security: []
tags: []
我的自定义连接器的定义如下:

    {
        "quotes": [
            {
                "quote_pk": 347,
                "shipment_name": "test add leg",
                "organization_ff_name": "LIFE",
                "quote_id": "1234",
                "effective_until": "2020-05-10",
                "eta": "2020-05-14T12:00:00Z",
                "price": 100.0,
                "quote_status": 2
            },
            {
                "quote_pk": 345,
                "shipment_name": "test modal review",
                "organization_ff_name": "LIFE",
                "quote_id": "123",
                "effective_until": "2020-05-11",
                "eta": "2020-05-22T12:00:00Z",
                "price": 1749.94,
                "quote_status": 6
            }
        ]
    }
swagger: '2.0'
info: {title: some title, description: some description, version: '1.0'}
host: server.domain.com
basePath: /organizations/endpoint/
schemes: [https]
consumes: []
produces: []
paths:
  /organizations/endpoint/shipment_quotes/: {}
  /shipment_quotes/:
    get:
      responses:
        '200':
          description: default
          schema:
            type: object
            properties:
              quotes:
                type: array
                items:
                  type: object
                  properties:
                    quote_pk: {type: integer, format: int32, description: quote_pk}
                    shipment_name: {type: string, description: shipment_name}
                    organization_ff_name: {type: string, description: organization_ff_name}
                    quote_id: {type: string, description: quote_id}
                    effective_until: {type: string, description: effective_until}
                    eta: {type: string, description: eta}
                    price: {type: number, format: float, description: price}
                    quote_status: {type: integer, format: int32, description: quote_status}
                description: quotes
      summary: peration summary
      description: operation description
      operationId: operationId
      parameters:
      - {name: Content-Type, in: header, required: false, type: string}
      - {name: Accept, in: header, required: false, type: string}
definitions: {}
parameters: {}
responses: {}
securityDefinitions: {}
security: []
tags: []
请帮助我获得正确的数据源,以便表单能够添加其字段,或者至少让我知道,如果由于某种原因无法添加字段,那么我可以继续。

正式地说,集合不能用作PowerApps中表单控件的数据源。你的努力令人钦佩,看起来你几乎什么都试过了,所以我要告诉你我的小秘密。 它可能没有官方支持,因此使用风险自负

  • 从自定义连接器创建响应集合(已完成)
  • 添加一个Gallery控件,并将其
    Items
    属性设置为集合(您已经完成了此操作)
  • 添加一个编辑表单控件,并将其
    DataSource
    属性设置到集合(您已经这样做了)
  • 单击三个小点并
    添加自定义卡
  • 将TextBox控件添加到自定义卡
  • 将文本框
    Default
    属性设置为
    gallery.Selected.X
    ,其中“X”是要在表单中编辑的值
  • 对要捕获的每个表单字段重复步骤4-7
  • 创建一个“提交”按钮,该按钮用于修补/更新集合,然后从自定义连接器调用POST(或PUT)方法,将编辑修补回数据源

    8a。我只在你的招摇过市文件中看到一个GET请求。您(显然)需要一个POST/PUT来将数据从集合返回到您的数据源

    8b。当您将“批准的”数据源用于表单控件时,PowerApps可能会为您处理这个小“包装器”

  • 注意:您的表单将在PowerApps studio中显示“无数据源”,但您的用户不会看到它

    它正在发挥作用:


    有什么帮助吗?

    非常感谢@SeaDude的回答,它非常全面和有用。尽管您的方法没有列在“官方”文档中,但它很有意义,我认为我们使用它是安全的。