My file contains data like:
First name: ahmed
Last name: nasser
City: giza
i created a schema to parse this file, but the element store all the line.. such as
<Fname>First name: ahmed</Fname>
<Lname>Last name: nasser</Lname>
i want the element to store only the value without the label
..to be like this:
<Fname>ahmed</Fname>
<Lname>nasser</Lname>
How To do that using Flate File Schema.. BizTalk?
Biztalk Flat File Schema Wizard will help you. You can use this text file you copied into the question as "Instance file" (1. page of the wizard). Tell the wizard that this file is a delimited one (3. page of the wizard) and the delimiter is ":" (4. page of the wizard). On the 5. page of the wizard you can set the labels to be ignored and that's all.
If the records of the input flat file are present in one line, I think the best if you simply remove the labels from the file. You can do this by creating a custom pipeline component, using C# it is super easy. After removing the labels your file will consist of pure data separated by : , which is a good format for a flat file schema.
Related
Good morning guys,
in my application asp.net MVC rdlc reports form through reportViewer.
The file export feature in the formats: pdf, xlsx, docx, by default, assigns the name of the rdlc file, so if, for example, my rdlc file is called ReportPippo.rdlc, I will get the export report, depending on of the chosen format: ReportPippo.pdf, ReportPippo.xlsx, ReportPippo.docx.
Is it possible to dynamically change the filename by not using the default name?
I would like to get something that gives a date / time to the filename so that I have a different file every time I print.
Thanks in advance.
You can set the file name at runtime with the LocalReport.DisplayName property.
I made a program to create Jobs field Tickets, and i want to add a option in the same form that open MSPaint or other program in a blank page using the ticket number as a file name, so, whoever is creating the Ticket can hand draw anything.
Create an empty template image file with appropriate dimensions and file type at a constant path
use FileCopy to copy it to your desired path & file name
use Shell to launch a mspaint.exe command-line with your file name as parameter.
I have multiple JSON files being looped over and populating a single template as seen in this question: Using Assemble, generate HTML files from multiple data files using one template file?
Each one of my JSON files has a title and description - how can I load these into the template (generally done with YFM) so that each generated HTML file has a unique title and description?
In assemble v0.4.x when you pass in the pages as a data object (like you're doing), only the data object is used. The data parsed out of the page content is not used.
Try updating your code to add the properties to data instead of concating the template:
// read in the data file
var data = grunt.file.readJSON(filepath);
data.title = data.project.projectTitle;
data.description = data.project.meata.description;
This is fixed in v0.6.x
Turns out that it's not important for the projectTemplate to have the YFM injected up top. To get it to show up, I just modified the data object with the title and description.
In essence, this gist https://gist.github.com/patrickng/c138c4ac8e6891fecbfc becomes https://gist.github.com/patrickng/5d36eb9ada2d353ff98e
I am working on Windows Application development using c#. I want to read a csv file from a directory and imported into sql server database table. I am successfully read and import the csv file data into database table if the file content is uniform. But I am unable to insert the file data with invariant form ex.Actually my csv file delimiter is tab('\t') and after getting individual fields I have a field that contains data like dcc
Name
----
xxx
xxx yyy
xx yy zz
and i rerieved data like xxx,yyy and xx,yy,zz so the insertion becomes problem.
How could i insert the data uniformly into a database table.
It's pretty easy.
Just read file line-by-line. Example on MSDN here:
How to: Read Text from a File
For each line use String.Split Method with your tab as delimiter. Method documentation and sample are here:
String.Split Method (Char[], StringSplitOptions)
Then working insert your data.
If a CSV (or TSV) value contains a delimiter inside of it, then it should be surrounded by quotes. See the spec for more details: https://www.rfc-editor.org/rfc/rfc4180#page-3
So your input file is incorrectly formatted. If you can convince the input provider to fix this issue, that will be the best way to fix the problem. If not, other solutions may include:
visually inspecting and editing the file to fix errors, or
writing your parser program to have enough knowledge of your data expectations that it can correctly "guess" where the real delimiters are.
If I'm understanding you correctly, the problem is that your code is splitting on spaces instead of on tabs. Given you have read in the lines from the file, all you need to do is:
string[] fileLines;//from the file
foreach(string line in fileLines)
{
string[] lineParts=line.Split(new char[]{'\t'});
}
and then do whatever you want with each lineParts. The \t is the tab character.
If you're also asking about writing the lines to a database file...you can just read in tab-delimited files with the Import Export Wizard (assuming you're using Sql Server Mgmt Studio, but I'm sure there are comparable ways to import using other db management software).
I have to create a tab delimited txt file from a query.
I want to call an HttpHandler that returns my txt file as a stream, I don't want to create the file phisically.
1st question:
what is the best practice to create the tab delimited txt file from a query result?
I have to fetch all rows and create the file manually?
2nd question:
How to set a timeout for the HttpHandler that creates the file?
Thanks for your time.
I would create a plain old http output stream and change the content type to 'text/plain' which means that you don't need to physically create the file on the web server, and if you add the content-disposition header to the output and specify that it has an attachment called something like 'report.txt' the user will be prompted to Open or Save the content, rather than just viewing it in the browser like a normal web page.
You can use the Server.ScriptTimeout = x to set the script timeout by gaining access to the current HttpContext object
Hope this helps