How to store data from a richtexteditor to accommodate searches? - sql-server

We're considering adding rich text editing to our system. I understand we'll get a heavily tagged string from our textareas. But I wonder about database searches for text within that data. There might be non-html tags containing versioning comments or other stuff that we wouldn't want to be searched.
How does something like this get implemented? Do we store the data twice, once with tags and once without? Or are there sql server tools to help skip tags during searches that won't kill us performance-wise?
(We're on sql server 2005 now, moving to 2008)

I would probably use full text search and include all HTML tags as stopwords. You can read more about these here.
Good luck!

Related

Generate a series of documents based on SQL table

I am trying to formulate a proposal for an application that allows a user to print a batch of documents based on data stored in a SQL table. The SQL table indicates which documents are due and also contains all demographic information. This is outside of what I normally do and am trying to see if these is a platform/application that already exists to do such a task
For example
List of all documents: Document #1 - Document #10
Person 1 is due for document #: 1,5,7,8
Person 2 is due for document #: 2.6
Person 3 is due for document #: 7,8,10
etc
Ideally, what I would like is for the user to be able to push a button and get a printed stack of documents that have been customized for each user including basic demographic info like name, DOB, etc
Like i said at the top, I already have all of the needed information in a database, I am just trying to figure out the best approach to move that information onto a document
I have done some research and found some people have used mail merge in Word or using Access as a front end but I don't know if this is the best way. I've also found this document. Any advice would be greatly appreciated
If I understand your problem correctly, your problem is two-fold: Firstly, you need to find a way to generated documents based on data (mail-merge) and secondly, you might need to print them two.
For document generation you have two basic approaches: template-based and programmatically from scratch. I suppose that you will opt for a template based approach which basically means that you design (in MS Word) a template document (Word, RTF, ...) that acts as a template and contains placeholders and other tags that designate »dynamic« parts of the document. Then, at document generation time, you need a .NET library/processor that you will pass this template document and the data, where the processor will populate the template with the data and return the resulting document.
One way to achieve this functionality would be employing MS Words' native mail-merge, but you should know that this would involve using Office COM and Word Application Automation which should be avoided almost always.
Another option is to build such a system on top of Open XML SDK. This is velid option, but it will be a pretty demanding task and will most probably cost you much more than buying a commercial .NET library that does mail-merge out-of-the-box – been there, done that. But of course, the good side here is that you will be able to tailer the solution to your needs. If you go down this road I recoment that you use Content Controls for tagging documents/templates. The solution with CCs will be much easier to implement than the solution with bookmarks.
I'm not very familliar with the open source solutions and I'm not sury how many there are that can do mail-merge. One I know is FlexDoc (on CodePlex) but its problem is that uses a construct (XmlControl) for tagging that is depricated in Word 2010+.
Then there are commercial solutions. Again I don't know them in detail but I know that the majority of them are a general purpose document processing libraries. Our company has been using this document generation toolkit for some time now and I can say it covers all our »template-based document generation« needs. It doesn't require MS Word at doc generation time, and has really helpful add-in for MS word and you only need several lines of code to integrate it in your project. Templating is very powerful and you can set-up a template in a very short time. While templates are Word documents, you can generate PDF or XPS docs as well. XPS is useful because you can use .NET/WPF prining framework that works with XPS docs to print documents. This is a very high-end solution, but of course, the downside here is that it is not a free solution.

Coldfusion Solr returns pieces of SQL query text in summary

For some reason, when parsing through solr collection results in Coldfusion, I get SQL query text that is inside the <cfquery> tag. Any way to prevent this?
You must be indexing actual files. Solr has no knowledge of ColdFusion or SQL or the cfquery tag. To Solr, the files are just text files and it is doing what you told it to do, which is to index the text inside.
Typically you would use Solr to index records in a database or just plain text files, for example which wouldn't contain your actual application code.
You might be able to find a filter for Solr that removes tags, perhaps an HTML filter or something, to remove code, but I'm not sure that would even get what you want. I would start by looking into the HTMLStripCharFilterFactory or the PatternReplaceCharFilterFactory. The former strips HTML, but I think it might just strip the cfquery tag and leave the SQL, which isn't what you want. The latter would allow you to write your own regular expressions to filter out content from the indexed documents. So you could write one that strips out the cfquery tags. You can find more information about these in the Solr documentation
All that said, really you shouldn't be indexing your application code with Solr. The content of your pages shouldn't be intermingled with the application code itself. The content should be stored in a database or other data storage mechanism and then only the content itself should be indexed.

How do I elegantly import an Excel file into Sql Server via a Coldfusion HTML form?

Does anyone have an elegant suggestion for how to get the contents of an Excel spreadsheet into SQL Server via a web form? I need to allow our clients to upload modest amounts of structured data, and I need that data to ultimately reside in a sql table. I really can't expect the clientele to produce anything but an Excel file, but I could require that it be an xlsx.
The web app is written in Coldfusion; it doesn't need to be able to handle huge numbers of simultaneous requests, but I don't want to consider some sort of server-side batch job processing or shunt the user to an asp.net page (which is what we are doing now).
Any recommendations (or examples of how others are successfully doing this) would be appreciated. Due to the sensitivity of the data, we really can't do anything to compromise the security of the web or sql servers.
If you are using CF9, then you could easily use the cfspreadsheet tag too. I mention this one specifically because Shawn's link did not (presumably due to its being relatively new on the CF scene). Here's the livedoc link: http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec17cba-7f87.html
For full use, I would create a web form with a standard file upload field. On the backend handling the form submission, get a copy of the file with
<cffile action="upload" destination="uploaded.xls".....>
Then use:
<cfspreadsheet action="read" query="myExcelData" src="uploaded.xls" ...>
At which point, your spreadsheet content will be available as a query object. You can then loop over this query, running insert queries into your sql server each time you loop. That should do it.
Here are the most notable options to help point you in the right direction; choose what you are most comfortable with (Source: Charlie Arehart).
CFXL
JXLS
CFX_Excel
My personal recommendation is to go the CFX_Excel route. Although a commercial product, it will grant you the most functionality/flexibility of the options listed.

What is best way to fill in data from database (sql server 2008) to word (word 2007 / template)?

I need to read data from my DB (MS SQL server 2008) and push them into Word document (Office 2007). What is the best and fast way to do it? I have read about the problem here : support.microsoft.com/kb/316384 and here : msdn.microsoft.com/en-us/library/aa192487(office.11).aspx. I have tried to understand also use of fleXdoc, but there is almost no documentation. I do not need to use it on server, i want generate locally. I will generate maximally 10 separate documents from template at maximum 5 pages per each. (Invoice for example). Please can someone point to some how-to or sample project, as i am unable to find something usefull. Thank`s a lot.
I suggest you output text files, CSV for example, and use those for your merge data files for Word.
You could use CustomXML databinding, but you will likely need to be able to handle repeating rows of data. That can be done (see http://dev.plutext.org/svn/docx4j/trunk/docx4j/sample-docs/databinding/conventions.html ), but may be overkill for your scenario.
What about making an HTML document for your data table, and including that in your Word document as an altChunk? See http://blogs.msdn.com/b/ericwhite/archive/2008/10/27/how-to-use-altchunk-for-document-assembly.aspx
Both of these approaches work with Word 2007 or later, using docx (Open XML) as the document format.
Something to be aware of however, the approach might not work with Office 2010. MS Had to remove a lot of the Custom XML merging stuff from Word as a result of a lawsuit about the technology. Updates to Office 2007 and definitely 2010 have some parts of that XML support removed.

Can you export packaging information (ERD or other data model) from Cognos 8.3?

I was wondering if there's a way to export package information from Cognos 8 from a regular user level or from the framework level.
For instance, I want the field names that cognos is pointing to on the database, i want the datatype, the description cognos uses when you right click a data element, etc..
Any suggestions?
(Unfortunately I'm not at my work computer right now) but Cognos saves everything in .xml files. I have an xml pretty printer that I use on model.xml before and after edits, so that I can use windiff to see what exactly changes in the model. I have also used an xml editor on model.xml on several occasions for global search and replace.
Having said that, I'm not sure how much of the database schema you can infer directly from model.xml, but I suspect if you had a script that could read and walk model.xml, and connect to the database to describe the objects, you could get what you need.
The answer appears to be yes, to anything that supports CWM (the Common Warehouse Model) but as for how...
One suggestion: ask IBM.
It appears that Powerdesigner 15 imports from xmi models.

Resources