Netsuite FreeMarker How to split String and Use the Index - html

I am new in NetSuite Technical, I am customizing the Invoice and Our Customer is using mix language in their Data Arabic & English together in the same Field, So if I use NotoSansArabic it will not Show the English Letters and If I remove the font; The Arabic Letters will not be shown properly.
so, I want to split the String in the Field to Show Each set of Language in the Invoice/report.
I want to split the field where the Character "-" is appeared to set the font for the first Splitted String NotoSanArabic and keep the second set normal
I want to do something like this
<td>
<#assign CustName={ record.entity} ? split( "-")>
</#assign>
CustName[0]
<!--Can I read the Index of the First Splitted String-->
CustName[1]
</td>
I will set the font for the index 0 to arabic and Keep the Index 1 as normal

Like this:
<#assign CustName=record.entity?split("-")>
${CustName[0]}
${CustName[1]}
However, this only works as expected if there's always exactly one - in the name. If that's not the case (and especially if there can be 0 - in it), then do this instead:
${record.entity?keep_before('-')}
${record.entity?keep_after('-')}

Related

Replace text next to static text google script

I would like to replace the text in a google doc. At the moment I have place markers as follows
Invoice ##invoiceNumber##
I replace the invoice number with
body.replaceText('##invoiceNumber##',invoiceNumber);
Which is fine but I can only run the script once as obviously ##invoiceNumber## is no longer in the document. I was thinking I could replace the text after Invoice as this will stay the same, appendParagraph looks like it might to the trick but I can't figure it out. I think something like body.appendParagraph("Invoice") would select the area? Not sure how to append to this after that.
You could try something like this I think:
body.replaceText('InvoiceNumber \\w{1,9} ','InvoiceNumber ' + invoicenumber);
I don't know how big your invoice numbers are but that will except from 1 to 9 word characters preceeded by a space and followed by a space. That pattern might have to be modified depending upon your textual needs.
Word Characters [A-Za-z0-9_]
If your invoice numbers are unique enough perhaps you could just replace them.
Reference
Regular Expression Syntax
Note: the regex pattern is passed as a string rather than a regular expression

Excel string to HTML code / inserting text mid string

How do I insert text (a URL link) from another cell (B1) into this cell (C1) containing HTML code like this:
<h4>Features</h4><ul><li>Available in other fabrics</li></ul>
Note:
- The insert text should fill in the tag.
- I tried using concat strings and convert the " into &CHAR(32) but it's not working.
- I have a few thousand rows of this data to work thru. Each URL link is different depending on the productSKU. So this process has to be automated.
- I am not familar with VB.
Thanks for your help.
So it should be something like
=SUBSTITUTE(C1,CHAR(34)&CHAR(34),CHAR(34)&B1&CHAR(34))
assuming the "" only occurs in the href tag.
It's easier than the alternative which would be
=SUBSTITUTE(C1,"""""",""""&B1&"""")
(you have to type a pair of double quotes for each double quote you want)
You might consider defining a name (say q) as =char(34) then it would be
=SUBSTITUTE(C1,q&q,q&B1&q)

Special Number format in MS Access

I have a table with an ID number which has a special format as follow: 2500-001
By default the number format does not accept dash(-) in the middle of number and I can not make it a Text field as I need this ID as the Primary Key.
Would you please tell me if there is anyway to achieve this in Design View?
Thank you in advance
Use a text box input mask.
You can specify whether or not the dash is included in the data. See here for more information about input masks:
The three parts of an input mask
Input masks are made up one mandatory
part and two optional parts, and each part is separated by a
semicolon. The purpose of each part is as follows:
The first part is mandatory. It includes the mask characters or string
(series of characters) along with placeholders and literal data such
as, parentheses, periods, and hyphens.
The second part is optional and
refers to the embedded mask characters and how they are stored within
the field. If the second part is set to 0, the characters are stored
with the data, and if it is set to 1, the characters are only
displayed and not stored. Setting the second part to 1 can save
database storage space.
The third part of the input mask is also
optional and indicates a single character or space that is used as a
placeholder. By default, Access uses the underscore (_). If you want
to use another character, enter it in the third part of your mask.

How do I check if values between html tags are blank or empty using regular expressions in notepad plus plus

I'm conducting a mass search of files in notepad++ and I need to determine if there are no values between a set of tags (i.e. ).
".*?" will search for 0 or more characters (well, most), which is fine. But I'm looking for a set of tags with at least one character between them.
".+?" is similar to the above and does work in notepad++.
I tried the following, which was unsuccessful:
<author>.{0}?</author>
Thank you for any help.
Since you look for something that doesn't exist you don't have to make it that complicated. Simply searching for <author></author> would do the trick, wouldn't it? If you want to include space-characters as "nothing" you could modify it to the following:
<author>\s*?</author>
Output:
<author></author> Match
<author> </author> Match
<author>something</author> No match
I don't understand why you are using the "?" operator; ".+" should yield the result you need.

Formatting a String Array to Display to Users

What is the best format to communicate an array of strings in one string to users who are not geeks?
I could do it like this:
Item1, Item2, Item3
But that becomes meaningless when the strings contain spaces and commas.
I could also do it this way:
"Item1", "Item2", "Item3"
However, I would like to avoid escaping the array elements because escaped characters can be confusing to the uninitiated.
Edit: I should have clarified that I need the formatted string to be one-line. Basically, I have a list of lists displayed in a .Net Winforms ListView (although this question is language-agnostic). I need to show the users a one-line "snapshot" of the list next to the list's name in the ListView, so they get a general idea of what the list contains.
You can pick a character like pipe (|) which are not used much outside programs. It also used in wiki markup for tables which may be intuitive to those who are familiar with wiki markup.
Item1| Item2| Item3
In a GUI or color TUI, shade each element individually. In a monochrome TUI, add a couple of spaces and advance to the next tab position (\t) between each word.
Using JSON, the above list would look like:
'["Item1", "Item2", "Item3"]'.
This is unambiguous and a syntax in widespread use. Just explain the nested syntax a little bit and they'll probably get it.
Of course, if this is to be displayed in a UI, then you don't necessarily want unambiguous syntax as much as you want it to actually look like something intended for the end user. In that case it would depend exactly how you are displaying this to the user.
Display each element as a cell in a table.
How about line breaks after each string? :>
Display each string on a separate line, with line numbers:
1. Make a list
2. Check it twice
3. Say something nice
It's the way people write lists in the real world, y'know :)
Use some kind of typographical convention, for example a bold hashmark and space between strings.
milk # eggs # bread # apples # lettuce # carrots
CSV. Because the very first thing your non-technical user is going to do with delimited data is import it into a spreadsheet.