Code after CFInclude seems to disappear or is not rendered - coldfusion

Having some issues with a ColdFusion application here. I'm trying to add in a <cfinclude template="header.cfm"/> and it renders correctly however the rest of the cf code seems to disappear, not sure if its not being rendered or just not showing up because of the cfinclude statement running. This is for a page header I'm trying to insert.
Is there a way to insert the cfincludes and have it stop so the rest of the page can process? Does my question make sense?
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
<!-- fwtable fwsrc="header.png" fwbase="default.gif" fwstyle="Dreamweaver" fwdocid = "742308039" fwnested="1" -->
<tr>
<td><img name="grantpro" src="images/grantpro.gif" width="411" height="80" border="0" alt=""></td>
<td><img name="gpimage" src="images/gpimage.jpg" width="189" height="80" border="0" alt=""></td>
</tr>
<tr>
<td colspan="2" align="center">
<table width="599px" border="0" align="center" cellpadding="1" cellspacing="1">
<tr>
<td colspan="4"><div align="center"><font size="5"><strong>FDC Menu</strong></font></div></td>
</tr>
<td colspan="3"><strong>FDC Pending Proposals:</strong></td>
</tr>
<tr>
<td> </td>
<td colspan="2">By Applicant Name</td>
</tr>
<tr>
<td> </td>
<td colspan="2">By Grant Type</td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="3"><strong>FDC Funded Proposals:</strong></td>
</tr>
<tr>
<td> </td>
<td colspan="2"><strong><em>Current Year</em></strong></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td>By Applicant Name</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td>By Grant Type</td>
</tr>
<tr>
<td> </td>
<td colspan="2"><em><strong>Prior Years</strong></em></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td>By Applicant Name </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td>By Grant Type</td>
<cfinclude template="cssmenu/header.cfm"/>
</table>
<p align="center"><strong>Logout</strong></p> </td>

The following code shows where the problem is
<tr>
<td> </td>
<td> </td>
<td>By Grant Type</td>
<cfinclude template="cssmenu/header.cfm"/>
</table>
Solution 1:
This is the recommended solution
The <cfinclude> probably should be moved outside of the </table>
Solution 2:
cssmenu/header.cfm would need to finish the current table row and start an new one. This is not recommended. It is not modular at all.
</tr>
<tr>
<td colspan="3">
... Content goes here ...
</td>
</tr>

You are missing a </tr> before the <cfinclude>. Also it seems like an odd place to include a header, rather add another table row and td and include the header inside of the <td> not in between the table code as this is causing it to break.

Related

Get verification code from a html string code using regex

I am currently writing an automation script, Where I read email Gmail through API and i am getting below html content. Now i need only code 191418 from this html content, I want to take it using regex. I tried with this
.*([0-9]{6})
To find 6 digit code but its returns 10 matchings, I am not good at regex, Can someone please help me to get the code using regex?
<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr"><br></div><u></u>
<div>
<center id="m_-2051398760120817894wrapper">
<table id="m_-2051398760120817894main" width="100%">
<tbody><tr id="m_-2051398760120817894logo">
<td>
<table width="100%">
<tbody><tr>
<td>
<img src="test.com/logo.png" width="140px" alt="xxxxx Logo" style="padding:0 10px">
</td>
</tr>
</tbody></table>
</td>
</tr>
<tr>
<td height="18px"></td>
</tr>
<tr id="m_-2051398760120817894header">
<td>
<table width="100%">
<tbody><tr>
<td height="64px" style="background-color:#10069f;color:#fff;padding-left:24px;font-weight:700">Reset your password</td>
</tr>
</tbody></table>
</td>
</tr>
<tr id="m_-2051398760120817894content">
<td>
<table width="100%">
<tbody><tr>
<td style="background-color:#f6f5ff;padding:24px 24px 16px 24px">
<p style="margin-top:0">The following is the verification code required to complete your password reset.</p>
<p style="margin-bottom:24px">Enter the following verification code on the screen during the registration, and proceed to the next step.</p>
<div style="display:block;text-align:center;margin-bottom:8px;background-color:#fff;height:92px;font-weight:600;font-size:36px;line-height:92px">191418</div>
<span style="display:block;font-size:12px;color:#5d5d5d">*The verification code is valid only for 24 hours.</span>
</td>
</tr>
</tbody></table>
</td>
</tr>
<tr>
<td height="24px"></td>
</tr>
<tr id="m_-2051398760120817894footer">
<td>
<table width="100%">
<tbody><tr>
<td style="background-color:#6d7777;padding:16px 24px;font-size:12px;color:#fff">
<table width="100%">
<tbody><tr>
<td id="m_-2051398760120817894footer-left">
<span style="display:block">amnimo Inc.</span>
<span style="display:block">0-3-30 usaa-fso, xxxxxxxx-shi, Tokyo, 180-8750, Japan</span>
<span style="display:block">Phone: +81-422-52-6779</span>
<span id="m_-2051398760120817894copyright-mb" style="margin-top:16px">© 2020 <div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr"><br></div><u></u>
<div>
<center id="m_-2051398760120817894wrapper">
<table id="m_-2051398760120817894main" width="100%">
<tbody><tr id="m_-2051398760120817894logo">
<td>
<table width="100%">
<tbody><tr>
<td>
<img src="https://test.com/logo.png" width="140px" alt="Amnimo Logo" style="padding:0 10px">
</td>
</tr>
</tbody></table>
</td>
</tr>
<tr>
<td height="18px"></td>
</tr>
<tr id="m_-2051398760120817894header">
<td>
<table width="100%">
<tbody><tr>
<td height="64px" style="background-color:#10069f;color:#fff;padding-left:24px;font-weight:700">Reset your password</td>
</tr>
</tbody></table>
</td>
</tr>
<tr id="m_-2051398760120817894content">
<td>
<table width="100%">
<tbody><tr>
<td style="background-color:#f6f5ff;padding:24px 24px 16px 24px">
<p style="margin-top:0">The following is the verification code required to complete your password reset.</p>
<p style="margin-bottom:24px">Enter the following verification code on the screen during the registration, and proceed to the next step.</p>
<div style="display:block;text-align:center;margin-bottom:8px;background-color:#fff;height:92px;font-weight:600;font-size:36px;line-height:92px">191418</div>
<span style="display:block;font-size:12px;color:#5d5d5d">*The verification code is valid only for 24 hours.</span>
</td>
</tr>
</tbody></table>
</td>
</tr>
<tr>
<td height="24px"></td>
</tr>
<tr id="m_-2051398760120817894footer">
<td>
<table width="100%">
<tbody><tr>
<td style="background-color:#6d7777;padding:16px 24px;font-size:12px;color:#fff">
<table width="100%">
<tbody><tr>
<td id="m_-2051398760120817894footer-left">
<span style="display:block">test Inc.</span>
<span style="display:block">2-9-32 ssdsa-sss, puakano-shi, Tokyo, 000-8000, Japan</span>
<span style="display:block">Phone: +81-000-00-652</span>
<span id="m_-2051398760120817894copyright-mb" style="margin-top:16px">© 2020 amnimo Inc.</span>
</td>
<td id="m_-2051398760120817894footer-right">
<span style="display:block">© 2020 amnimo Inc.</span>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</center>
</div>
</div></div> Inc.</span>
</td>
<td id="m_-2051398760120817894footer-right">
<span style="display:block">© 2020 test Inc.</span>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</center>
</div>
</div></div>
You should use some DOM library that will let you query the element you want and get its content. Parsing HTML with regex is bad idea.
If you must do it, getting six numbers is not enough - after inspecting, I see that it's div content. So I would write something among the lines:
<div[^>]*>\d{6}<\/div>
Pattern explanation:
<div - match <div literally
[^>]* - match zero or more characters other from >
> - match > literally
\d{6} - match 6 digits
<\/div> - match <\/div> literally
Regex demo
EDIT
In order to extract desired text, use capturing groups:
<div[^>]*>(\d{6})<\/div>
Then text in first capturing group will be your desired result.
Maybe try word boundaries, which will prevent matching inside longer numbers:
\b([0-9]{6})\b
https://regex101.com/r/dQAiHU/1/

Graphviz/ Table/ How to merge cells

I would like to draw a graph like this -
I have Graphviz code like this -
digraph G {
"test" [
label = <<table border="0" cellspacing="0">
<tr>
<td port="f0" border="1" bgcolor="darkorange">TEST</td>
<td port="f1" border="1" bgcolor="darkorange"></td>
</tr>
<tr>
<td port="f2" border="1" bgcolor="cyan">A</td>
<td>
<table border="0" cellspacing="0">
<tr><td port="f3" border="1" bgcolor="azure">A1</td></tr>
<tr><td port="f4" border="1" bgcolor="azure">A2</td></tr>
<tr><td port="f5" border="1" bgcolor="azure">A3</td></tr>
</table>
</td>
</tr>
<tr>
<td port="f5" border="1" bgcolor="gray">Else</td>
<td port="f6" border="1" bgcolor="gray"></td>
</tr>
</table>>
shape = "none"
];
}
But it gives the graph like this
Would you please suggest how can we tweak the code to achieve the objective - merging f0, f1 on top and f5,f6 at bottom?
You can use HTML <td>s with colspan and rowspan attributes in GraphViz. These allow one cell to span multiple columns and/or rows inside a table.
This also simplifies your digraph, as only one table is needed.
digraph G {
"test" [
label = <<table border="0" cellspacing="0">
<tr>
<td colspan="2" port="f0" border="1" bgcolor="darkorange">TEST</td>
</tr>
<tr>
<td rowspan="3" port="f5" border="1" bgcolor="blue">A</td>
<td port="f6" border="1" bgcolor="white">A1</td>
</tr>
<tr>
<td port="f6" border="1" bgcolor="white">A2</td>
</tr>
<tr>
<td port="f6" border="1" bgcolor="white">A3</td>
</tr>
<tr>
<td colspan="2" port="f0" border="1" bgcolor="grey">Else</td>
</tr>
</table>>
shape = "none"
];
}
This gives you the following basic output, which you can then customize for spacing, line colors, etc:
This one also works. what's is the difference?
digraph G {
"test" [
label = <<table border="0" cellspacing="0">
<tr><td colspan="2" port="f0" border="1" bgcolor="darkorange">TEST</td> </tr>
<tr><td rowspan="4" port="f5" border="1" bgcolor="blue">A</td></tr>
<tr><td port="f6" border="1" bgcolor="white">A1</td></tr>
<tr><td port="f6" border="1" bgcolor="white">A2</td></tr>
<tr><td port="f6" border="1" bgcolor="white">A3</td></tr>
<tr><td colspan="2" port="f0" border="1" bgcolor="grey">Else</td></tr>
</table>>
shape = "none"
];
}

How to transpose into the "same" column?

I have a table like
<table class="tg">
<tr>
<th class="tg-0lax">date</th>
<th class="tg-0lax">organic</th>
<th class="tg-0lax">referrer</th>
<th class="tg-0lax">direct</th>
</tr>
<tr>
<td class="tg-0lax">01.01.2019</td>
<td class="tg-0lax">12345</td>
<td class="tg-0lax">123</td>
<td class="tg-0lax">23</td>
</tr>
<tr>
<td class="tg-0lax">25.01.2019</td>
<td class="tg-0lax">23456</td>
<td class="tg-0lax">234</td>
<td class="tg-0lax">34</td>
</tr>
<tr>
<td class="tg-0lax">03.03.2019</td>
<td class="tg-0lax">34567</td>
<td class="tg-0lax">345</td>
<td class="tg-0lax">56</td>
</tr>
<tr>
<td class="tg-0lax">15.04.2019</td>
<td class="tg-0lax">45678</td>
<td class="tg-0lax">456</td>
<td class="tg-0lax">78</td>
</tr>
</table>
I want to get the data into this view, where all data are placed into the same three columns, not dependently of whether points in the first column are repeated:
<table class="tg">
<tr>
<th class="tg-0lax">type</th>
<th class="tg-0lax">source</th>
<th class="tg-0lax">date</th>
</tr>
<tr>
<td class="tg-0lax">organic</td>
<td class="tg-0lax">12345</td>
<td class="tg-0lax">01.01.2019</td>
</tr>
<tr>
<td class="tg-0lax">referrer</td>
<td class="tg-0lax">123</td>
<td class="tg-0lax">01.01.2019</td>
</tr>
<tr>
<td class="tg-0lax">direct</td>
<td class="tg-0lax">23</td>
<td class="tg-0lax">01.01.2019</td>
</tr>
<tr>
<td class="tg-0lax">organic</td>
<td class="tg-0lax">23456</td>
<td class="tg-0lax">25.01.2019</td>
</tr>
<tr>
<td class="tg-0lax">referrer</td>
<td class="tg-0lax">234</td>
<td class="tg-0lax">25.01.2019</td>
</tr>
<tr>
<td class="tg-0lax">direct</td>
<td class="tg-0lax">34</td>
<td class="tg-0lax">25.01.2019</td>
</tr>
<tr>
<td class="tg-0lax">organic</td>
<td class="tg-0lax">34567</td>
<td class="tg-0lax">03.03.2019</td>
</tr>
<tr>
<td class="tg-0lax">referrer</td>
<td class="tg-0lax">345</td>
<td class="tg-0lax">03.03.2019</td>
</tr>
<tr>
<td class="tg-0lax">direct</td>
<td class="tg-0lax">56</td>
<td class="tg-0lax">03.03.2019</td>
</tr>
<tr>
<td class="tg-0lax">organic</td>
<td class="tg-0lax">45678</td>
<td class="tg-0lax">15.04.2019</td>
</tr>
<tr>
<td class="tg-0lax">referrer</td>
<td class="tg-0lax">456</td>
<td class="tg-0lax">15.04.2019</td>
</tr>
<tr>
<td class="tg-0lax">direct</td>
<td class="tg-0lax">78</td>
<td class="tg-0lax">15.04.2019</td>
</tr>
</table>
The "normal" transposing is pretty close to what I want, but even not exactly this, and I miss the point, how to pivot the data.
Another one example:
Got an error:
What I'm doing wrong? The formula is:
=ARRAYFORMULA({"type","source","date";SPLIT(TRANSPOSE(SPLIT(CONCATENATE(IF(B2:D<>"","♠"&B1:D1&"♦"&B2:D&"♦"&A2:A, )),"♠")),"♦")})
The line breaks are from the formula away - I've deleted them. Could the error cause be that my Google Spreadsheets used in Germany - formula language issue?
=ARRAYFORMULA({"type", "source", "date";
SPLIT(TRANSPOSE(SPLIT(CONCATENATE(IF(B2:D<>"",
"♠"&B1:D1&"♦"&B2:D&"♦"&A2:A, )), "♠")), "♦")})

DAX - filtering out whole row from data table that meets certain condition(s)

I have a table like following:
<style type="text/css">
.tg {border-collapse:collapse;border-spacing:0;}
.tg td{font-family:Arial, sans-serif;font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;}
.tg th{font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;}
.tg .tg-baqh{text-align:center;vertical-align:top}
</style>
<table class="tg">
<tr>
<th class="tg-baqh">Store Name</th>
<th class="tg-baqh">Week Number</th>
<th class="tg-baqh">Sales</th>
<th class="tg-baqh">Sales-LY</th>
</tr>
<tr>
<td class="tg-baqh">Store A</td>
<td class="tg-baqh">1</td>
<td class="tg-baqh">20</td>
<td class="tg-baqh">15</td>
</tr>
<tr>
<td class="tg-baqh">Store A</td>
<td class="tg-baqh">2</td>
<td class="tg-baqh">25</td>
<td class="tg-baqh">20</td>
</tr>
<tr>
<td class="tg-baqh">Store A</td>
<td class="tg-baqh">3</td>
<td class="tg-baqh">30</td>
<td class="tg-baqh">25</td>
</tr>
<tr>
<td class="tg-baqh">Store B</td>
<td class="tg-baqh">1</td>
<td class="tg-baqh">15</td>
<td class="tg-baqh">10</td>
</tr>
<tr>
<td class="tg-baqh">Store B</td>
<td class="tg-baqh">2</td>
<td class="tg-baqh">15</td>
<td class="tg-baqh">15</td>
</tr>
<tr>
<td class="tg-baqh">Store B</td>
<td class="tg-baqh">3</td>
<td class="tg-baqh">20</td>
<td class="tg-baqh">15</td>
</tr>
<tr>
<td class="tg-baqh">Store C</td>
<td class="tg-baqh">1</td>
<td class="tg-baqh">30</td>
<td class="tg-baqh">25</td>
</tr>
<tr>
<td class="tg-baqh">Store C</td>
<td class="tg-baqh">2</td>
<td class="tg-baqh">0</td>
<td class="tg-baqh">20</td>
</tr>
<tr>
<td class="tg-baqh">Store C</td>
<td class="tg-baqh">3</td>
<td class="tg-baqh">25</td>
<td class="tg-baqh">20</td>
</tr>
</table>
I would like to return (lets' say) a pivot table with
Salex IDX = SUM(Sales)/SUM(Sales-LY) as a measure, ignoring the data points for "Week 2 for Store C".
So it's not a filter on just Week Number or Store, but its a filter on specific row(s) identified by multiple parameters.
Essentially, i would like to get 'like for like' results, excluding any weeks where Sales or Sales-LY columns are zero(or null)
Any ideas?
I would add a calculated column to concatenate Store and Week, something like this:
=[Store Name]&", Week: "&[Week Number]
Then you can use a filter or slicer to exclude the Store & Week combination you want.

Grails gsp template. Pass params from gsp and accept their on template

<g:each var="dep" in="${depList}">
<tr>
<td>
${dep.depName}
</td>
<td>
${dep.location}
</td>
<td>
<g:render template="listTemplate" model="${dep.clients}"/>
</td>
<td>
<g:checkBox name="departments" value="${dep.id}" checked="false" />
</td>
</tr>
</g:each>
From gsp page I need send model(params) depList on the template where I'm accept their/ How can I do this?
very close:
<g:render template="listTemplate" model="[clients:dep.clients]"/>
You can use like this.
<g:each var="dep" in="${depList}">
<tr>
<td>
${dep.depName}
</td>
<td>
${dep.location}
</td>
<td>
<g:render template="listTemplate" model="[clientlist: dep.clients]"/>
</td>
<td>
<g:checkBox name="departments" value="${dep.id}" checked="false" />
</td>
</tr>
</g:each>