Need help to create tabular report using html

(imported topic written by Darknight)

Hi All,

I have below session relevance created :

( item 0 of it as string & “$x$” &

item 1 of it as string & “$x$” &

item 2 of it as string & “$x$” &

item 3 of it as string )

of (

(if (exists Names of Applicable Computers of it)

then (Names of Applicable Computers of it as string)

else ("")),

(if (exists Source ID of it)

then (Source ID of it as string)

else ("")),

(if (exists Source Severity of it)

then (Source Severity of it as string)

else ("")),

(if (exists Name of it)

then (Name of it as string)

else ("")))

of

bes fixlets

whose (

(display name of site of it = “Patches for Windows (English)”) AND

(((Category of it as lowercase contains “critical updates”) OR

(Category of it as lowercase contains “security update”) OR

(Category of it as lowercase contains “definition updates”) OR

(Category of it as lowercase contains “service pack”) OR

(Category of it as lowercase contains “rollup”)

OR

(Category of it as lowercase contains "update"))

OR

((Source Severity of it as lowercase contains “critical”) OR

 (Source Severity of it as lowercase contains "important") OR

(Source Severity of it as lowercase contains “moderate”) OR

(Source Severity of it as lowercase contains “unspecified”))

AND

((Name of it as lowercase does not contain “sql”)

OR

(Name of it as lowercase does not contain “office”)

OR

(Name of it as lowercase does not contain “visual studio”)

OR

(Name of it as lowercase does not contain “excel”)

OR

(Name of it as lowercase does not contain “visio”))

AND

(Applicable Computer Count of it > 0))


output of which is in format :

VM675401$x$2803821$x$Critical$x$Security Update for Windows Server 2003 (KB2803821)

VM675404$x$2850869$x$Critical$x$Security Update for Windows Server 2003 (KB2850869)


i want to see the result in the belwo format (that is an excel format):

Computer Name

KB-Article

Severity

Update Title

VM675401

2803821

Critical

Security Update for Windows Server 2003 (KB2803821)

VM675404

2850869

Critical

Security Update for Windows Server 2003 (KB2850869)

Can someone please assist me in achiving this result using html.

thanks in advance.

(imported comment written by Lee Wei)

You can try this code at the front of the statement, replacing the block with that bunch of “item x of” statements.

I have not changed anything below that.

(
html “<table border=1 style=%22border-collapse: collapse; border: medium none;%22>” &
html (“

Computer NameKB-ArticlesSeverityUpdate Title”) & it &
html “”
) of concatenations of trs of
( td of item 0 of it &
td of item 1 of it &
td of item 2 of it &
td of item 3 of it)

Complete statement would be:

(
html “<table border=1 style=%22border-collapse: collapse; border: medium none;%22>” &
html (“

Computer NameKB-ArticlesSeverityUpdate Title”) & it &
html “”
) of concatenations of trs of
( td of item 0 of it &
td of item 1 of it &
td of item 2 of it &
td of item 3 of it)
of (
(if (exists Names of Applicable Computers of it)
then (Names of Applicable Computers of it as string)
else ("")),
(if (exists Source ID of it)
then (Source ID of it as string)
else ("")),
(if (exists Source Severity of it)
then (Source Severity of it as string)
else ("")),
(if (exists Name of it)
then (Name of it as string)
else ("")))
of
bes fixlets
whose (
(display name of site of it = “Patches for Windows (English)”) AND
(((Category of it as lowercase contains “critical updates”) OR
(Category of it as lowercase contains “security update”) OR
(Category of it as lowercase contains “definition updates”) OR
(Category of it as lowercase contains “service pack”) OR
(Category of it as lowercase contains “rollup”)
OR
(Category of it as lowercase contains “update”))
OR
((Source Severity of it as lowercase contains “critical”) OR
(Source Severity of it as lowercase contains “important”) OR
(Source Severity of it as lowercase contains “moderate”) OR
(Source Severity of it as lowercase contains “unspecified”))
AND
((Name of it as lowercase does not contain “sql”)
OR
(Name of it as lowercase does not contain “office”)
OR
(Name of it as lowercase does not contain “visual studio”)
OR
(Name of it as lowercase does not contain “excel”)
OR
(Name of it as lowercase does not contain “visio”))
AND
(Applicable Computer Count of it > 0)))

(imported comment written by Lee Wei)

(imported comment written by Darknight)

Thanks a lot Lee Wei. i am able to get the report in desired format whenever i am running above format in html but when i try to run this in custom report i am not able to get the result , i think some additional steps are needed to get this presented in tabular form( i have attahced teh screenshot for your reference).Please help. also i have few more queries .

  1. Is there any html/js script format by which i can have a drop down in all the headers so that i cxan get unique items out of all the values.

Eg : If i select Computer Name : 2003 -SE - SERVER (as per your screenshot) i should get all the KB-Articles , Severity,Updated Title relevant to 2003 -SE - SERVER machine. Also same applies to all the other columns.

  1. Can i have export to excel function embedded in js or html script.

Thanks a trillion again . Please guide me about mentioned two requirements.

(imported comment written by Lee Wei)

In order to use this Session Relevance statement in Web Reports as a Custom Report, we need to enclose the statement using the tag:

<?relevance xxxx ?>

A custom report is merely Web Reports processing standard web technologies, including HTML/JavaScript, etc.

By enclosing the statement in a tag, Web Reports will send it to the Relevance engine for processing.

Replace xxxx with the entire long statement that we worked on above.

You other questions are then largely HTML and JavaScripting exercises.

Here are 2 examples that have dynamic Session Relevance queries based on some combobox selection, and also JavaScript to sort HTML tables.

https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014743368&ps=25

https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014744532&ps=100

Lee Wei

(imported comment written by Darknight)

Thanks a lot Lee…i have gone through both posts and it was usefull.

on A simillar note could you please give me post/scripts os some examples for exporting my report to excel.

Thanks in advance.

(imported comment written by Lee Wei)

Sorry again that this is a more complicated topic than it would appear to be.

When we export something to Excel from a browser, there are architecturally 2 ways of doing it.

  • We can export (actually download) the file from the Web server, which is done by almost all sites. This is the right and best way because you “trust” the web site and you are downloading some file from there, which might be PDF, Excel, Zip, or even an Exe.

However, we run into a problem here because we need a proper Web server that you can develop from, and IEM Web Reports is not intended to be used that way, It is not a full-fledged Web server.

  • So our next option is to generate a file from the Client and Browser side. This is what the Compliance Reports do. Everything is written in JavaScript that runs on the client-side. The issue here is that the Browser is supposed to be a sandbox and it is not supposed to write files to your local disk, which poses as a security risk. So there are techniques to make this work, which is implemented again in the Compliance Reports that I have created.

So search the net for examples on writing to an Excel file from the Browser and you will get a lot of examples.

Lee Wei