web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / How to fetch the respo...
Copilot Studio
Unanswered

How to fetch the response in the Power virtual agents as an table format with clear separation with lines between the rows and columns.

(0) ShareShare
ReportReport
Posted on by 6

Hi,

I was trying to fetch the data from SQL server database table and returning that as a PVA response using power automate flow and then fetch the response as table format in PVA.

But I tried many ways but I am getting the response as mentioned in the screenshot below without the lines of separation between the rows and columns, so please help to get the clear structure of table as a response.

Thanks in advance.

Categories:
I have the same question (0)
  • HenryJammes Profile Picture
    on at

    Hi @Anand2 -

     

    Is the question about formatting? i.e. the actual lines between lines and columns?

    I'm guessing you're using the standard Markdown format.

    For advanced formatting, I would look at adaptive cards.

     

    Can you share the table payload as JSON or Power Fx?

     

    Henry

  • Anand2 Profile Picture
    6 on at

    Hi Henry 

     

    Yes the question was about formatting. Can you try with the following json structure like in this json the vertical and service line are the column names and remaining are the values for that. So please try to retrive a clear cut table from this.

     

    [
    {
    "vertical": "Hitech & Manufacturing Services",
    "Service Line": "Supply Chain Analytics"
    },
    {
    "vertical": "Others",
    "Service Line": "F&A Analytics"
    },
    {
    "vertical": "Others",
    "Service Line": "Supply Chain Analytics"
    },
    {
    "vertical": "CPG & Retail",
    "Service Line": "Customer Analytics"
    }
    ]

     

     

  • HenryJammes Profile Picture
    on at

    Not sure why grid lines are not rendered in adaptive card.

    Alternatively, you could have branded rows:

     

    HenryJammes_0-1698250740478.png

     

  • Anand2 Profile Picture
    6 on at

    Hi Henry,

    Thank you for spending your valuable time on this issue. If possible can you please share me the flow which you have used to create the above table structure.

    And once can you confirm weather the lines of separation are possible in Power virtual agents or not??

    Thanks

  • HenryJammes Profile Picture
    on at

    Hi @Anand2,

     

    For separator grid line formatting, indeed the standard chat client (in the test pane or the one you deploy with the HTML snippet) don't seem to be rendering them.

     

    But you have to remember that Adaptive Card is a standard format that each client interprets differently. So, the same adaptive card in Teams will look different than the Web Chat client, Outlook Actionable Messages, etc.

    You can preview some of the different rendering here: https://adaptivecards.io/designer/

     

    As to my example, I started from your JSON example. 

    So, you could imagine that your Power Automate cloud flow returns that JSON as a string variable.

    Then, I do these things:

     

    #1 I parse the JSON into a Table variable 

    I used the sample JSON you provided to define the schema and data type.

     

    HenryJammes_0-1698312109728.png

     

    #2 I added an "Index" column to the dataset to number each line (1, 2, 3...)

    This is simply to later formatted odd/even rows differently.

     

    HenryJammes_1-1698312172629.png

     

    I use a formula for this:

    ForAll(
        Sequence(
            CountRows(Topic.Table)
        ),
        {
            Index: Value,
            Vertical: Index(Topic.Table, Value).vertical,
            'Service Line': Index(Topic.Table, Value).'Service Line'
        }
     )
     

    #3 Send an adaptive card with dynamic content.

    Here, I pasted my adaptive card JSON I had created in the adaptive card designer and transformed in into formula. That's where I make part of the adaptive card dynamic, based on the table content.

    Basically, I add a row for each row in my TableWithIndex variable, and I also have different formatting for every other row.

     

    HenryJammes_2-1698312474014.png

     

     

    You can preview how I built my example using the below YAML.
    Simply paste it in a new, blank, topic code editor view.

     

    kind: AdaptiveDialog
    beginDialog:
     kind: OnRecognizedIntent
     id: main
     intent:
     displayName: Untitled
     triggerQueries:
     - Table Formatting
    
     actions:
     - kind: SetVariable
     id: setVariable_jOf99j
     variable: Topic.JSON
     value: "[ { \"vertical\": \"Hitech & Manufacturing Services\", \"Service Line\": \"Supply Chain Analytics\" }, { \"vertical\": \"Others\", \"Service Line\": \"F&A Analytics\" }, { \"vertical\": \"Others\", \"Service Line\": \"Supply Chain Analytics\" }, { \"vertical\": \"CPG & Retail\", \"Service Line\": \"Customer Analytics\" } ]"
    
     - kind: ParseValue
     id: XD1MyN
     variable: Topic.Table
     valueType:
     kind: Table
     properties:
     Service Line: String
     vertical: String
    
     value: =Topic.JSON
    
     - kind: SetVariable
     id: setVariable_RES66Q
     variable: Topic.TableWithIndex
     value: |-
     =ForAll(
     Sequence(
     CountRows(Topic.Table)
     ),
     { 
     Index: Value,
     Vertical: Index(Topic.Table, Value).vertical,
     'Service Line': Index(Topic.Table, Value).'Service Line'
     }
     )
    
     - kind: SendActivity
     id: sendActivity_laZobv
     activity:
     attachments:
     - kind: AdaptiveCardTemplate
     cardContent: |-
     ={
     type: "AdaptiveCard",
     '$schema': "http://adaptivecards.io/schemas/adaptive-card.json",
     version: "1.5",
     body: [
     {
     type: "Table",
     columns: [
     {
     width: "1"
     },
     {
     width: "1"
     }
     ],
     rows: [
     {
     type: "TableRow",
     cells: [
     {
     type: "TableCell",
     items: [
     {
     type: "TextBlock",
     text: "Vertical",
     wrap: true
     }
     ]
     },
     {
     type: "TableCell",
     items: [
     {
     type: "TextBlock",
     text: "Service Line",
     wrap: true
     }
     ]
     }
     ]
     }
     ],
     separator: true,
     gridStyle: "emphasis"
     },
     {
     type: "Table",
     columns: [
     {
     width: "1"
     },
     {
     width: "1"
     }
     ],
     rows: ForAll(Topic.TableWithIndex,
     {
     type: "TableRow",
     cells: [
     {
     type: "TableCell",
     items: [
     {
     type: "TextBlock",
     text: Vertical,
     wrap: true
     }
     ]
     },
     {
     type: "TableCell",
     items: [
     {
     type: "TextBlock",
     text: 'Service Line',
     wrap: true
     }
     ]
     }
     ],
     style: If(Mod(Index,2)=0,"default","accent")
     }
     ),
     firstRowAsHeaders: false,
     gridStyle: "emphasis"
     }
     ]
     }

     

     

     

  • HenryJammes Profile Picture
    on at

    Hi @Anand2 - let me know if the above sample helps.

     

    In the meantime, I also got confirmation that the Web Chat client doesn't style HTML table. Thus, they are as-is from vanilla HTML, so they do not have borders.

    You can raise a new feature request for this on the Bot Framework Web Chat repository on GitHubNew Issue · microsoft/BotFramework-WebChat (github.com)You can also style it if you know how to use Web Chat customization features.

     

    Henry

  • Anand2 Profile Picture
    6 on at

    Hi Henry,

    Please can you provide me with the complete power automate flow and the topic, I was bit confused and getting some errors.


    Thanks.

  • HenryJammes Profile Picture
    on at

    Hi @Anand2 

     

    I don't have access to your backend systems, so I'm not using any flow here.

    I just used the JSON you provided as an input variable for my topic in PVA.

    I would recommend doing the same here: call Power Automate from PVA to retrieve data (in a JSON format) and then format it in a nice adaptive card.

    The topic I shared helps you understand each step -- you just need to paste it in a new blank topic, using the code editor view. You can access it by clicking on the ... at the top right corner.

     

    Henry

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Copilot Studio

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 255 Super User 2025 Season 2

#2
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 205 Super User 2025 Season 2

#3
S-Venkadesh Profile Picture

S-Venkadesh 101 Moderator

Last 30 days Overall leaderboard