cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jsincontrol
Frequent Visitor

Error Running html.table

So this is porbably a really silly question but I have looked and looked and I am not sure what I am doing wrong.

I have a column with stored htmlcode in it and I want to get the values out of the html tables in that code. An example is below is I am trying to return the columns "Application" and "Version" with the records ("Controller client", "8.0.37") and ("Web Logger","8.0.20") as two seperate rows in either 2 new columns in the same query or a completley different query.

 

 

<col /></colgroup><tbody><tr><th>Application</th><th>Version</th><th colspan=\"1\">Server</th><th colspan=\"1\">URL/ URI / Port details / CNAME / dB Names</th></tr><tr><td>Controller Client</td><td>8.0.37</td><td colspan=\"1\"><br /></td><td colspan=\"1\"><br /></td></tr><tr><td>Web Logger</td><td>8.0.20</td>

 

 

So I thought I could use the Html.Table function to do this with the following

 

 

let
    Source = Html.Table("HTMLDetails,TestData",{"Application","App"},"<td>")
in
    Source​

 

 

 However I am getting back We cannot convert the value "<td>" to type Record

Details:

Value=<td>

Type=[Type]

 

Any suggestions would be really appreciated please.

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @jsincontrol ,

 

Add <table> at the beginning of the code and </table> at the end.

 

<table><col /></colgroup><tbody><tr><th>Application</th><th>Version</th><th colspan=\"1\">Server</th><th colspan=\"1\">URL/ URI / Port details / CNAME / dB Names</th></tr><tr><td>Controller Client</td><td>8.0.37</td><td colspan=\"1\"><br /></td><td colspan=\"1\"><br /></td></tr><tr><td>Web Logger</td><td>8.0.20</td></table>

 

 

Then try to add a custom column like this:

 

= Html.Table([Column1],{{"Application","tr>:nth-child(1)"},{"Version","tr>:nth-child(2)"}},[RowSelector="tr"])

 

custom1.gif

 

Or this:

 

= Html.Table([Column1],{{"Application","tr>:nth-child(1)"},{"Version","tr>:nth-child(2)"}},[RowSelector="tbody>:nth-child(n+2)"])

 

custom2.gif

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Icey
Community Support
Community Support

Hi @jsincontrol ,

 

Add <table> at the beginning of the code and </table> at the end.

 

<table><col /></colgroup><tbody><tr><th>Application</th><th>Version</th><th colspan=\"1\">Server</th><th colspan=\"1\">URL/ URI / Port details / CNAME / dB Names</th></tr><tr><td>Controller Client</td><td>8.0.37</td><td colspan=\"1\"><br /></td><td colspan=\"1\"><br /></td></tr><tr><td>Web Logger</td><td>8.0.20</td></table>

 

 

Then try to add a custom column like this:

 

= Html.Table([Column1],{{"Application","tr>:nth-child(1)"},{"Version","tr>:nth-child(2)"}},[RowSelector="tr"])

 

custom1.gif

 

Or this:

 

= Html.Table([Column1],{{"Application","tr>:nth-child(1)"},{"Version","tr>:nth-child(2)"}},[RowSelector="tbody>:nth-child(n+2)"])

 

custom2.gif

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

bdarbo78
Frequent Visitor

That saved my day ! But how did you find out about this syntax ? 

jsincontrol
Frequent Visitor

Icey, thanks so much for a solution. Sorry I didn't reply sooner but just tested now. That is perfection 🙂

lbendlin
Super User III
Super User III

Who told you to use "<td>"  ?  That's not how Html.Table needs to be called.

 

Html.Table - PowerQuery M | Microsoft Docs

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Kudoed Authors