Using a page item as its value in LIKE statement - sql

I want to get all the titles from a table in an interactive report where a certain word is found within another column of that table (article column). The word would be input through a text field called "TEXT". This is what I have in the interactive report region source:
SELECT title as "Word found in"
FROM articles
WHERE article like '% :TEXT %'
I'm not sure how to deal with the "TEXT" text field, this worked for equal (as in WHERE something =: TEXT)
Thanks!

SELECT title as "Word found in"
FROM articles
WHERE instr(TEXT, article)>0;
I'm not at all sure what you're doing here, but this may work for you.

Related

Select only email from a message- Open Refine

I have columns with several cells like this:
"Hi my email is mail#mail.com feel free to email me!"
"Hey, this is my email: mail2#mail.com"
I want to create a new column from there with this cells:
"mail#mail.com"
"mail2#mail.com"
Thank you!
You can search the for mail adresses with regex (take a look here). An easy example for such a regex would be /\b\S+#\S+\.\S+\b/
To use it in OpenRefine:
Click on column
"Edit column"
"Add column based on this column…"
set "New column name"
set "Expression" with something like value.find(/\b\S+#\S+\.\S+\b/)[0]
Ok

My vb.net code just replaces specified string by contents of rich text box. But I want to replace it with alignment also

I need to replace a specific string in a MS Word with text of Rich Text Box. I have achieved my that using the following code.
objDoc.Content.Find.Execute(FindText:="Comments1", _
ReplaceWith:=COMMENTS.Text, _
Replace:=Microsoft.Office.Interop.Word.WdReplace.wdReplaceAll)
But, What my actual requirement is.. I want to replace it by exact text of rich text box with alignment.
For example :
Kindly add the title to you article,
Kindly add the abstract to your article
the above text is the content of rich text box.
But, in my word document it replaced as
Kindly add the title to you article, 2. Kindly add the abstract to your article
Have you noticed that ? After the 1st point I have hit enter key and then only I have give 2nd point.
But, resultant text are concatenated with the 1st point.
So, what to do to get exact text with alignment of rich text box in my word document.
I seem to recall something about Rich Text Box using vbLf for line feeds instead of vbCrLf, which I believe is what MS Word would expect to be used for a line feed. You might try something like this (air code):
objDoc.Content.Find.Execute(FindText:="Comments1", _
ReplaceWith:=COMMENTS.Text.Replace(vbLf, vbCrLf), _
Replace:=Microsoft.Office.Interop.Word.WdReplace.wdReplaceAll)

VB.Net string contains exact match

I'm wondering if there is a way to search for an exact text match in a text box
for example
using "if textbox1.text.contains("Hello") then" works
however i only want it to search for text "Hello" and if i have 2 words like this
HelloFriend
Hello Friend
I only want it to find the word matching so the second statement Hello Friend and not HelloFriend as this doesn't match the keyword.
Is this possible?
You can make a regular expression that matches the word with word boundaries:
if Regex.IsMatch(textbox1.Text, "\b" + Regex.Escape("Hello") + "\b") Then
try to checkout
this one
or
this one
may be this one will help you :)

Replacing captions in Word documents with automated numbering, using VBA macro

I have a large MS Word document with a lot of captions named like this:
"Map X. Map title.". The problem is that the "X" are not in ascending order. I'd like to fix it running VBA macro that will replace the "X" to a right number.
I have no problem with replacing strings but I would like to know what should I replace the "X" with (what is the type of object associated with automated numbering).
The numbers will go up for every type of Caption (e.g. "Map", "Chart"), without restarting inside chapters.
Okay, I found something that might help. There is a type of Field that you can add that will create a automatic number sequence for a given reference. So will we take your example above "Map X. Map title", if you can set you code to select 'X' and then follow it with...
MyRef = "Map"
Selection.Fields.Add(Selection.Range, , "SEQ " & MyRef, False).Update
Once that's done you may need to press ALT+F9, to hide/show the Field codes

Formatting text from Mulitline text box in word with VBA

I'm putting together a template in Word, using a form for the user to fill in to then populate some of the document.
The bit I'm currently stuck on is at the end of the document, where the cc's are listed.
The form has a multiline text box into which the user puts in their cc's, one per line.
I then want to add to the end of the document the contents of the text box, but in the right format. Specifically, it should look like:
cc: First CC contact
Second CC contact
so on and so forth
I attempted to do this using 2 bookmarks, so my code currently is:
' If 'CC' box has content, add it
If doc_CC.TextLength > 0 Then
.Bookmarks("CC").Range.Text = vbCr + "cc:"
.Bookmarks("CCs").Range.Paragraphs.Indent
.Bookmarks("CCs").Range.Text = doc_CC + vbCr
End If
However, when this is run, on the page it looks like:
cc: first contact
second contact
and so on
Realise that the 2 bookmark method is a bit messy but it seemed like a good idea at the time - obviously this is not the case! Have done some searching for a way to do it with Split but am not making much progress down this path - suspect I'm googling for the wrong thing.
How do I do this so that the formatting is as desired? Any help is greatly appreciated.
Try inserting a tab character? + Chr(9) or even + vbTab may work.
Have found a work around which, while doesn't answer the actual question of how to do it, does produce a result to the same effect.
Have used a 2 column table without no lines instead with contents of a1 being "cc:" and contents of a2 being whatever was entered into the multiline text box. If there is nothing in the text box, then the table is deleted.
I'll keep on eye on this question though so if some one does have the proper answer I can mark it accordingly.
Another possibility would be to format the cc paragraph with a hanging indent (like is used for bullets or numbering). Use a newline character - Chr(11) - instead of vbcr to separate each entry. The text should all line up,then...