cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
jonathanO
Level: Powered On

Populate Gallery from Dynamic LogicApps Response

I have a LogicApp that calls a stored procedure on an on-premise SQL database.  The stored procedure returns back a dynamic list of Employees.  I'd like to populate a gallery in PowerApps with this list of employees so that the user can choose an Employee.

 

The LogicApp is connected to PowerApps via a custom connector.  There is a first name and last name text input filed in PowerApps and the Search button's On Select property triggers the LogicApp.  In the LogicApp, I have a Response action defined which will return to PowerApps the stored procedure results in this format:

 

{
  "Table1": [
    {
      "EmployeeNumber": 12345,
      "EmployeeName": "John Dough",
      "ManagerEmployeeNumber": 54321,
      "ManagerEmployeeName": "Pete Za"
    },
    {
      "EmployeeNumber": 112233,
      "EmployeeName": "Test Person",
      "ManagerEmployeeNumber": 332211,
      "ManagerEmployeeName": "Bob Roberts"
    },
    {
      "EmployeeNumber": 223344,
      "EmployeeName": "Roger Rabbit",
      "ManagerEmployeeNumber": 443322,
      "ManagerEmployeeName": "Bugs Bunny"
    },
    {
      "EmployeeNumber": 334455,
      "EmployeeName": "Jane Doe",
      "ManagerEmployeeNumber": 554433,
      "ManagerEmployeeName": "John Smith"
    },
    {
      "EmployeeNumber": 445566,
      "EmployeeName": "Elvis Presley",
      "ManagerEmployeeNumber": 665544,
      "ManagerEmployeeName": "George Washington"
    }
  ]
}

 

 

Does anybody have any suggestions on how to get the reponse from the LogicApp populated into the gallery?  Or rather, has anyone been able to populate a gallery from a custom connector that produces a dynamic list?

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
jonathanO
Level: Powered On

Re: Populate Gallery from Dynamic LogicApps Response

I was able to figure this out.  I defined the response in the swagger defintion like this:

 

        "responses": {
          "default": {
            "description": "default",
            "schema": {
              "type": "object",
              "properties": {
                "Table1": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "EmployeeNumber": {
                        "type": "integer",
                        "format": "int32",
                        "description": "EmployeeNumber",
                        "x-ms-summary": "EmployeeNumber"
                      },
                      "EmployeeName": {
                        "type": "string",
                        "description": "EmployeeName",
                        "x-ms-summary": "EmployeeName"
                      },
                      "ManagerEmployeeNumber": {
                        "type": "integer",
                        "format": "int32",
                        "description": "ManagerEmployeeNumber",
                        "x-ms-summary": "ManagerEmployeeNumber"
                      },
                      "ManagerEmployeeName": {
                        "type": "string",
                        "description": "ManagerEmployeeName",
                        "x-ms-summary": "ManagerEmployeeName"
                      }
                    }
                  },
                  "description": "Table1",
                  "x-ms-summary": "Table1"
                }
              }
            }
          }
        },

I then set my Search button On Select to ClearCollect the result of the LogicApps call.  The gallery uses that collection as the datasource.

1 REPLY 1
jonathanO
Level: Powered On

Re: Populate Gallery from Dynamic LogicApps Response

I was able to figure this out.  I defined the response in the swagger defintion like this:

 

        "responses": {
          "default": {
            "description": "default",
            "schema": {
              "type": "object",
              "properties": {
                "Table1": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "EmployeeNumber": {
                        "type": "integer",
                        "format": "int32",
                        "description": "EmployeeNumber",
                        "x-ms-summary": "EmployeeNumber"
                      },
                      "EmployeeName": {
                        "type": "string",
                        "description": "EmployeeName",
                        "x-ms-summary": "EmployeeName"
                      },
                      "ManagerEmployeeNumber": {
                        "type": "integer",
                        "format": "int32",
                        "description": "ManagerEmployeeNumber",
                        "x-ms-summary": "ManagerEmployeeNumber"
                      },
                      "ManagerEmployeeName": {
                        "type": "string",
                        "description": "ManagerEmployeeName",
                        "x-ms-summary": "ManagerEmployeeName"
                      }
                    }
                  },
                  "description": "Table1",
                  "x-ms-summary": "Table1"
                }
              }
            }
          }
        },

I then set my Search button On Select to ClearCollect the result of the LogicApps call.  The gallery uses that collection as the datasource.