Convert HTML text into Readable text - Using Electronic Reporting in D365 Finance and Operations
Convert HTML text into Readable text - Using Electronic Reporting in D365 Finance and Operations
What's the Problem:
Have a look at the table browser
Text is saved as HTML text. If we try to create the reports and pick the data from this field, the system will pick the data as it is.
To test this, we can move into Electronic Reporting and do some debugging. For more info on Electronic reporting. You can visit Electronic reporting (ER) overview - Finance & Operations | Dynamics 365 | Microsoft Docs
In case you have missed my previous post, refer to Missing Number Sequence List - Electronic reporting.
Navigate to Workspaces -> Electronic Reporting -> Reporting configurations -> Create new configuration -> Add data model -> Map model to Data sources.
Add a Datasource of Table records "CaseLog" table. Click on start debugging
Now we are clear with our problem statement. Let's search for the solution.
Here is the solution:
I tried to search for some patterns in the Notes field. There are HTML tags like <div></div>, <span></span>, <br>, <p></p> etc along with the HTML attributes like style, margin etc. All the text which want to extract; comes after the character ">" but before the "</", so we need to remove all the other data which is lying between two tags.
I start searching over Google with the search words "how to remove the HTML characters from HTML text". Luckily I found some hints from the blog Convert Email Body from HTML format to Text | CloudFronts.
This blog is related to CRM but from the coding part, I got the idea of how to search for the text between two tags.
The main credit for the solution goes to the "Replace" function available in Electronic reporting. Refer to REPLACE ER Function| Microsoft Dynamics.
In the calculated fields, I write the formula as shown below:
Let's check now from the debugger. Now data stored into notes are converted to normal text which can be used for reporting purposes.
Our problem is resolved. Thanks for reading.
Happy Neeraxing! 😃
By Neeraj Kumar
Comments
Post a Comment