I have a table with column headers coming from localization keys. The table code is in an Editable Text webpart. Unfortunatly, the macro is showing in search results. is there a way to avoid this, or limit the smart search webpart? Worst case is i drop the localization implementation.
Here's my code snippet:
<thead>
<tr>
<th scope="col">{$kff.Generic-Name$}</th>
<th class="type" scope="col">{$kff.Generic-Type$}</th>
</tr>
</thead>
So those macros are page content. You can control what you're showing in search result changing appropriate transformation. Also you might try to go to the appropriate page type search fields and change Content field.
You can call the CMS.MacroEngine.MacroResolver.Resolve(string contentResult) method within your smart search transformation to get those macros resolved into text (or resource strings).
Related
I'm using Node Puppeteer to generate a PDF from a webpage using Chrome Headless. It works really well, apart from a small issue I'm coming across where if a table spans over more than one page sometimes one of the rows will appear larger than expected and the date column having text appear at the top of the row.
This is how it looks in the browser
This is how it is rendered on the pdf (some parts are blurred for confidentiality)
As you can see on the created column on the second page in the PDF view the date and time in the first row are distorted. There is nothing unusual about that row in the html version.
The table follows this structure;
<table>
<thead>
<tr>
<th>Project</th>
<th>Status</th>
<th>Creator</th>
<th>Created</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<div>Project Name</div>
<div>Reference</div>
</td>
<td>
<img src="status.png" alt="Some Stagus"> Some Status
</td>
<td>
<div class="avatar"></div>
</td>
<td>
<div>29/10/2020</div>
<div>10:00:00</div>
</td>
</tr>
</tbody>
</table>
I'm not sure if this is a bug with chrome headless, when I print preview in chrome is shows the same issue as the generated pdf. Any suggestions or pointers would be very welcome.
This is going to sound stupid, and I hate this answer... but it worked for me.
Add a dummy row in between your normal rows. Something like ...
<tr style="height: 0px; !important"></tr>
You'll notice that the broken row has 2x height. I'm guessing the issue is triggered when the first pixel of a row lands EXACTLY on a page break, and then the renderer attempts to add the row twice, once on the previous page and once on the current page. But since it doesn't fit on the previous page, it rolls over and doubles up on the current page. ( PURELY SPECULATION )
Given this hypothesis, adding a dummy row with no height between every normal row lets you hide this issue by having the dummy row be the target of the bug. I'm assuming that since its height it 0, it can always squeeze in on the previous page without overflowing and/or it does overflow and get doubled, but since its height is 0 it doesn't matter.
Anyways, this was a nightmare to figure out a hack-fix. It worked for me, I truly hope it works for you, and I hope puppeteer releases an update one day that improves on page-break logic.
I would like to know if there's a way to extract this email with the Email subject: Mani Inc. / ACF-SAFE / ABC123-563 / Submission document / MFR ABC1235 Follow-up #1 / Due Date: 10-Mar-2020
with the Email Body:
into this Excel template below?
The 1st row is for Email subject: Mani Inc. / ACF-SAFE / ABC123-563 / Submission document / MFR ABC1235 Follow-up #1 / Due Date: 10-Mar-2020 while the 2nd row information is for Email subject: Mani Inc. / ACF-SAFE / ABC123-563 / Submission document / MFR ABC1235 Initial / Due Date: 10-Mar-2020
Currently the only way I can think of is to use VBA to extract the Email Subject and Email body into Excel and then use formulas to extract the specific information to the Excel template? Is there a simpler way?
Thanks for any help in advance!
VBA can catch the email data in Outlook. Parse data in it and place it in the template.
VBA in Excel can also forward the template by email to next point in the process chain.
Your last question is impossible to answer concisely.
You have two separate problems: (1) how to extract the data you want from the email and (2) how to store that data in an Excel worksheet in the format you require. There is little point worrying about problem 2 until you have solved problem 1.
An email can have three bodies: a text body, and an Html body and an RTF body. I have never seen a Rich Text Format body, so it is unlikely you have one of them.
If the sender only includes a text body, that is what you will see. Your image shows a table that you can only have with an Html body. If the sender includes both a text and an Html body, you see the Html body, but the text body is available to a VBA macro. In 99.9% of the emails that I have examined, the sender has only included an Html body. In such cases Outlook creates a text body by deleting all the Html formatting and replacing the major end tags with one or two CRLFs.
So, you have two choices: (1) extract the data you want from the Html body or (2) extract the data from the text body.
The advantage of trying to extract from the Html body is that it will include something like:
<p>Dear Colleagues</p>
<p>Kindly find attach a document for review</p>
<table xxxxxxxx>
<tr xxxxxx>
<td xxxxxxx>MFR#</td>
<td xxxxxxx>Report Date</td>
<td xxxxxxx>Due Date</td>
<td xxxxxxx>Protocol#</td>
<td xxxxxxx>Comment</td>
</tr>
<tr xxxxxx>
<td xxxxxxx>ABC1235</td>
<td xxxxxxx>01-Mar2020</td>
<td xxxxxxx>10-Mar-2020</td>
<td xxxxxxx>ABC123-45</td>
<td xxxxxxx> </td>
</tr>
</table>
<table xxxxxxxx>
<tr xxxxxx>
<td xxxxxxx>Time</td>
<td xxxxxxx>SCDAD</td>
<td xxxxxxx>SAFETY\180 Submission</td>
</tr>
</table>
That is all the data you require is delimited by <td> and </td>. The first disadvantage is all the xs which represent formatting instructions. The second, possible disadvantage is the sender may include CSS (Cascading style sheets) so the table will display one way on a PC and another way on a smartphone. In this case, the Html could be very much more complicated than I have shown.
The text body will probably look like this:
Dear ColleaguesCRLFCRLF
Kindly find attach a document for reviewCRLFCRLF
MFR#CRLFCRLF
Report DateCRLFCRLF
Due DateCRLFCRLF
Protocol#CRLFCRLF
CommentCRLFCRLF
ABC1235CRLFCRLF
01-Mar2020CRLFCRLF
10-Mar-2020CRLFCRLF
ABC123-45CRLFCRLF
CRLFCRLF
TimeCRLFCRLF
SCDADCRLFCRLF
SAFETY\180 SubmissionCRLFCRLF
With the text body, all the formatting has been removed for you but there is nothing to indicate where the tables, rows and cells start and top.
Only by looking at the Html and text bodies can you decide which will be easier to process.
Please look at this answer of mine: https://stackoverflow.com/a/58000707/973283.
This answer includes an Outlook macro that outputs selected properties of selected emails to the Immediate Window or outputs many properties of selected emails to a desktop file. You need the second option since this includes both the text and the Html bodies. You can review the two bodies and decide which looks easier to process. Alternatively, you can include the relevant parts of the bodies in your question and someone may recommend an approach.
I'm using Freemarker in NetSuite's Advanced PDF/HTML templates to generate an Invoice. For specific item types, I want to display "1" instead of the actual quantity on the Invoice. This is based on the item category drop down field selection of "Services". My current attempt is below.
<#if record.custitem_item_category?string?contains("Services")>
<td align="center" colspan="3" line-height="150%">1</td>
<#else>
<td align="center" colspan="3" line-height="150%">${item.quantity}</td>
</#if>
I tried validating the initial #if statement with ?has_content but it just skipped to the #else statement so think I've missed something there.
From the field name custitem_xx it sounds like you are trying to access a Custom Item Field. Two problems here. Firstly you need to read the value from each line (i.e. it should be item.item.custitem_item_category not record.custitem_item_category. But additionally (unless it's been recently fixed), doing so in NetSuite just returns the value from the first line of the sublist for every single line item.
What you need to do is create a Custom Transaction Line Field and source in the value from the item, which you would then access like item.custcol_item_category.
[When you create the custom field, uncheck Store Value to make sure it is always sourcing in the latest value, and also make sure it is checked under Screen Fields on the form to display in the UI - otherwise it is not available to your template either. If you do want to hide it in the UI, you can just blank out the label.]
Your if statement looks correct, which means that record.custitem_item_category?string?contains("Services") is not returning the value you think it is. Typically you would only use ?string on a number to convert it to a string, if it is already a string, this is unnecessary.
Try just printing out ${record.custitem_item_category} on each line and see what results you get. If some of them contain 'Service' then you should be fine with record.custitem_item_category?contains("Services") in your if statement.
Below thing works...
<#if item.colname=="Package"> (here you can set 1)
<#elseif item.colname=="Discount"/> (here you can set 2)
<#else>
Using Python WebDriver, how can I select a radio button based upon the text of a separate element such as this label?
My current code has the ability to click the radio button by id. But I have no idea how it is possible to click it when I am depending on text from a completely separate element.
The following is a pic of what i'm up against.
All help is greatly appreciated! =)
I've created a simplified example of your html on the screenshot, and assuming you want to get radio button which following sibling has "test text2", you need to use xpath axes:
<table>
<tbody>
<tr>
<td><input id="test_id" type="radio" value="123" /></td>
<td>test text</td>
<td>test text2</td>
<td>test text3</td>
</tr>
</tbody>
</table>
XPath would be: //tr/td[contains(text(),"test text2")]/preceding-sibling::td/input
The logic is:
get an element with specific text
go to previous sibling element (sibling == same level element)
now go deeper to td/input from there
I want to get an element in Sahi script using multiple custom attributes of my choice.
It is a <td > having different attributes which are dynamically generated. The title attribute is blank that is "". example of the element definition is as follow:
<td title="" rownumber="1" rmbnum="0,1" rowId="8090.9008.6352.8721" class="my-class my-class2" position="4">
Here the row id is dynamically generated.
I need to click on this element once this element is clicked then a textbox is generated and we need to fill value in it - value is text format.
I want to use rmbnum and position attributes to get this element.
I have searched the sahi forum but was not able to find it.
regards,
Rahul
You can use
_cell({rmbnum:"0,1",position:"4"})
The documentation has been updated now. http://sahi.co.in/w/browser-accessor-apis
You can also try use
_cell(_table(“items”), rowIndex, columnIndex)
_cell(_table(“items”), rowName, columnName)
See http://sahi.co.in/w/_cell for examples.