Customer Banners (Ads) - SpiceUp. AX and SpotfireX Disclaimer



If you find this site useful and you want to support, buy me a coffee   to keep this site alive and without ads.

Extract filtered rows to an html table

#get list of filtered rows
dataTable = Document.ActiveDataTableReference
rows = Document.ActiveFilteringSelectionReference.GetSelection(dataTable).AsIndexSet()

#generate html table
#generate html head
html = " <TABLE id='myTable'>\n"
html += " <THEAD>\n"
html += "  <TR>"

#generate html header
for column in dataTable.Columns:
   html += "<TH>" + column.Name + "</TH>"
html += "  </TR>\n"
html += " </THEAD>\n"

#generate html rows
html += " <TBODY>\n"
for r in rows:
   html+="  <TR>"
   for column in dataTable.Columns:
      html += "<TD>" + column.RowValues.GetFormattedValue(r) + "</TD>"
   html+="  </TR>\n"

#finish html
html += " </TBODY>\n"
html += "</TABLE>\n"

#show results
print html

No comments: