Data for column is shown with tags
Hi ,
We are using one stored procedure where we have one column and its data is coming with tags . and when we used that stored procedure and created a data table , then we found the same issue in the report . the data for column is coming with tags . So how can we exclude tags from there . so that we get only data .Please find a screenshot below.
Its quite urgent .
Thanks,
Simran
-
If the data is stored with HTML tags, it is going to be returned from the stored procedure with HTML tags.
You can set the format for the label to HTML to render that label's contents as HTML
<Report ID="LogiForum.htmlFormat">
<Body>
<DataTable ID="dt">
<DataLayer Type="Static">
<StaticDataRow Column1="Row 1" Column2="<p>
This paragraph
contains a lot of lines
in the source code,
but the browser
ignores it.
</p>

<p>
This paragraph
contains a lot of spaces
in the source code,
but the browser
ignores it.
</p>" />
<StaticDataRow Column1="Row 2" Column2="<h1>This is heading 1</h1>
<p>This is some text.</p>
<hr>
<h2>This is heading 2</h2>
<p>This is some other text.</p>
<hr>" />
</DataLayer>
<DataTableColumn ID="colColumn1" Header="Column1">
<Label ID="lblColumn1" Caption="@Data.Column1~" />
<DataColumnSort DataColumn="Column1" />
</DataTableColumn>
<DataTableColumn ID="colColumn2" Header="Column2">
<Label ID="lblColumn2" Caption="@Data.Column2~" Format="HTML" />
<DataColumnSort DataColumn="Column2" />
</DataTableColumn>
</DataTable>
</Body>
</Report>If you don't want to display the html formatting, you can use a user defined function inside sql to unwrap html tags. This would probably be the best solution, but since you are dealing with a stored procedure, you may not have this ability.
https://stackoverflow.com/questions/457701/how-to-strip-html-tags-from-a-string-in-sql-serverYou can use a JavaScript function within the formula for a calculated column which removes the tags as well.
<Report ID="LogiForum.htmlFormat">
<Body>
<DataTable ID="dt">
<DataLayer Type="Static">
<StaticDataRow Column1="Row 1" Column2="<p>
This paragraph
contains a lot of lines
in the source code,
but the browser
ignores it.
</p>

<p>
This paragraph
contains a lot of spaces
in the source code,
but the browser
ignores it.
</p>" />
<StaticDataRow Column1="Row 2" Column2="<h1>This is heading 1</h1>
<p>This is some text.</p>
<hr>
<h2>This is heading 2</h2>
<p>This is some other text.</p>
<hr>" />
<CalculatedColumn Formula="("@Data.Column2~").replace(/(<([^>]+)>)/gi, "")" ID="Column2" />
</DataLayer>
<DataTableColumn ID="colColumn1" Header="Column1">
<Label ID="lblColumn1" Caption="@Data.Column1~" />
<DataColumnSort DataColumn="Column1" />
</DataTableColumn>
<DataTableColumn ID="colColumn2" Header="Column2">
<Label ID="lblColumn2" Caption="@Data.Column2~" />
<DataColumnSort DataColumn="Column2" />
</DataTableColumn>
</DataTable>
</Body>
<ideTestParams />
</Report>0 -
Hi VISUI ,
This is working fine if we format the label to HTML . but when we refresh the data table it causes the below mentioned error .
I just added a refresh element and that's required to add that element .
And if we are using second approach by using Javascript its not completely removing the html tags and also its removing the tags without impacting the label i.e., <h1> hello</h> , here its removing this <h> but not increasing its font size .Please find a screenshot below.
Thanks,
Simran
0 -
Hi VISUI ,
One point also i would like to add , if we have image as a value in the column , then image is not getting shown in the column if we set format of label as HTML . Also when we are taking export , its keeps on loading the export page . I believe its because of we have image in the column . Please find a screenshot below for an reference .In this screenshot i removed HTML format from this column to show tags
Thanks,
Simran
0 -
If the image is not showing up within the browser, it is probably the link itself is posing issues for logi. Possibly the SSL url?
If the image is not showing up within the export, it could potentially be the same issue. Try to keep image src local to the logi
The following worked for me:<Report ID="LogiForum.htmlFormat">
<Body>
<DataTable ID="dt">
<DataLayer Type="Static">
<StaticDataRow Column1="Row 1" Column2="<p>
This paragraph
contains a lot of lines
in the source code,
but the browser
ignores it.
</p>

<p>
This paragraph
contains a lot of spaces
in the source code,
but the browser
ignores it.
</p>" />
<StaticDataRow Column1="Row 2" Column2="<h1>This is heading 1</h1>
<p>This is some text.</p>
<hr>
<h2>This is heading 2</h2>
<p>This is some other text.</p>
<hr>" />
<StaticDataRow Column1="Row 2" Column2="<h1>This is heading 1</h1>
<p>This is some text.</p>
<hr>
<h2>This is heading 2</h2>
<p>This is some other text.</p>
<img src="http://localhost/VISUIClients/_SupportFiles/avatar2.png" height="50px" width="50px"/>
<hr>" />
<Remark>
<CalculatedColumn Formula="("@Data.Column2~").replace(/(<([^>]+)>)/gi, "")" ID="Column2" />
</Remark>
</DataLayer>
<DataTableColumn Header="Column1" ID="colColumn1">
<Label Caption="@Data.Column1~" ID="lblColumn1" />
<DataColumnSort DataColumn="Column1" />
</DataTableColumn>
<DataTableColumn Header="Column2" ID="colColumn2">
<Label Caption="@Data.Column2~" ID="lblColumn2" Format="HTML" />
<DataColumnSort DataColumn="Column2" />
</DataTableColumn>
</DataTable>
<Button Caption="export" ID="btn">
<Action Type="PDF" ID="act">
<Target Type="PDF" ExportDataTableID="dt" Report="CurrentReport" />
</Action>
</Button>
</Body>
<ideTestParams />
</Report>web
pdf
0 -
Hi VISUI,
Thanks, But the problem is when we take an export of the table it causes this type of an error , this time its related to hr because i used one dummy table with dummy row , but sometimes it happens with img . it generally happens with all those tags which are not compulsory to close in HTML . but logi throws an error while exporting like excel.
I used one dummy table with below mentioned data :
I got this error -
But if iam modifying the data by adding hr closing tag , then i am able to take an export in excel .
0 -
Logi's engine generally uses XSHTML not HTML. You should ALWAYS close your HTML tags when adding any HTML elements within Logi. If you were to do an AJAX refresh on an element displaying invalid XSHTML, you will most likely get an error as well.
https://www.w3schools.com/html/html_xhtml.asp
The following Report demonstrates this.
<Report ID="LogiForum.RefreshInvalidHTML">
<Body>
<HtmlTag HtmlTagName="div" ID="html1" HtmlTagText="HTML1">
<HtmlAttributeParams style="background-color: silver; height: 200px; width: 400px; margin: 20px;" />
<IncludeHtml Html="<h1>Not valid XSHTML @Function.DateTime~" />
</HtmlTag>
<Button ID="btnRefresh1" Caption="Refresh HTML1">
<Action Type="RefreshElement" ElementID="html1" ID="are1" />
</Button>
<HtmlTag HtmlTagName="div" ID="html2" HtmlTagText="HTML2">
<HtmlAttributeParams style="background-color: silver; height: 200px; width: 400px; margin: 20px;" />
<IncludeHtml Html="<h1>Valid XSHTML @Function.DateTime~</h1>" />
</HtmlTag>
<Button ID="btnRefresh2" Caption="Refresh HTML2">
<Action Type="RefreshElement" ElementID="html2" ID="are1" />
</Button>
</Body>
<ideTestParams />
</Report>0
Please sign in to leave a comment.
Comments
6 comments