ASP.NET: Gridview Formatting Columns with DataFormatString - asp.net

I want to change these values with DataFormatString properties in Gridview.
1.000000 --> 1 --> Deleting all digits after .
366705.000000 --> 366,705 --> Deleting all digits after . and put the comma for seperate.
12.830000 --> %12,83 --> Delete last 4 digits after . and put % (% is optinal not must)
BTW, Is there any link to suggest me otherwise DataFormatString. I analyze very well this page but sometimes still can't find what I need about data format string.

Here you go. I didn't test #3 - if it's not right, it's close.
1
Convert the number to an int.
2
String.Format("{0:n"}, 366705);
3
(12.83 / 100).ToString("{%#0.00}", el-GR);
A couple helpful formatting web pages:
Custom Numeric Formatting
SteveX Compiled - blog with many samples

Related

Row Truncated Between Pages

As shown in the images below sometimes the rows are truncated/split beteween two pages of my report.
Is there any property I can set on DevExpress XtraReport to avoid it?
Details:
The DetailBand contains 3 fields and is inside a subreport (it's a 2 columns/subreport).
The subreport is printed inside a GroupHeader in the MainReport.
The truncated text reads (in 3 columns):
343
HONORÁRIOS - FREE LANCERS
R$ 2.126,42
Happened I found the issue.
My databands all have the flag KeepTogether set to true but labels also have that flag (default false).
I flipped the flag to true in all labels in the report and it worked

Modify the dates in a huge file (around 1000 rows) using script

I have a requirement in which I need to subtract x number of days from dates present in a delimited file if the date exists excluding the first and last row. If the date does not exist in the specified field, ignore the same.
For example, aaa.txt contains
header
abc|20160431|dhadjs|20160325|hjkkj|kllls
ddd||dhajded|20160320|dwdas|hfehf
footer
I want the modified file to have the dates subtracted by 10 days. Something like below:-
header
abc|20160421|dhadjs|20160315|hjkkj|kllls
ddd||dhajded|20160310|dwdas|hfehf
footer
I don't want to use a programming language like Java to read the file but rather use a scripting language on unix. Any suggestions on how this can be done?

Excel / CSV Merge Text and Cell Data for Wordpress Import

I have several Wordpress HTML pages for import through CSV/excel. One of the fields is content for the Wordpress page. Since these pages are all the same except for in 3 places (2 names, 1 IMG URL) I'm trying to be efficient and upload an excel with custom fields.
What I'd like to do is merge the IMG urls and Product Names into the appropriate spot in the Excel cell text so it's imported as a complete page. I'm trying to avoid all the cutting and pasting when adding 100's of similar pages with only a few different spots.
Any tips or advice on where I can accomplish this? I haven't been able to figure it out or find help online.
Cell Data Example:
<div id="productimage" style="float:left;width:380px;">
<img alt="alternate" src="imagesource" />
</div>
<div id="productspecs" style="float:left;padding-left:25px;">
<h2><strong>Product Name</strong></h2>
</div>
"Product Name", "alternate", and "imagesource" I have fields for in a spreadsheet .. I just don't know how to merge them into this Cell Data Example to auto-populate these new pages.
Thanks!
If I understand your question correctly, you have html in an Excel cell and you want to make parts of that html dynamic by referencing content in other cells of the workbook.
I assume that in your example you want to make the imagesource and the Product Name dynamic.
You can copy and paste the html into the Excel formula editor. You can increase its height, so you see more than one line at a time. The formula editor can handle line breaks.
If you want to build a string that contains double quotes, you will need to use two double quotes if the quote is inside the string and three double quotes in a row if it is at the beginning or end of a string. You can use the ampersand to concatenate strings and cell references.
With your specific example above, the formula in Excel would read somewhere along these lines (replace Sheet2!A2 etc. with the cell that holds your data. Arrange that data in a table with a row for each product, then you can copy this formula down to get the desired result.
="<div id=""productimage"" style=""float:left;width:380px;"">
<img alt=""alternate"" src="""&Sheet2!A2&""" />
</div>
<div id=""productspecs"" style=""float:left;padding-left:25px;"">
<h2><strong>"&Sheet2!B2&"</strong></h2>
</div>"
Turn on "Wrap Text" in the cell format, otherwise you will see it all in one line of code. The screenshot below uses two rows of data with different texts for image source and product name in sheet 2.
EDIT: I tried to post this in a comment, but the double and triple quotes don't make it and get replaced with just one quote.
Also, you managed to delete some of the & signs that concatenate the different strings. Please look again at the original formula I've posted. Replace the cell references with yours, but don't mangle the code. The principle is this:
="First String"&A1&"Next String"
If the string has quotes inside, double them
="He said "Please" but nobody heard him"&A1&"next string"
If the string has quotes at the beginning of the string, then you need the opening quote for the string and the double quote for the quote inside the string. Likewise for quotes at the end of the string: duplicate the quote in the string and then add the closing quote.
="""Please" - he said"&A1&"and she answered "OK."""

Trouble finding a function to convert float into a comma seperated thousands ASP CLASSIC

Having trouble finding a function to convert float into a comma seperated thousands in ASP CLASSIC
it needs to format a variety of numbers:
0.01
-.1
100000.45
993000
they should end up like:
0.01
-0.1
100,000.45
993,000
Would FormatNumber(yournumber, 2) work for you?
The thousands separator is a part of how your data is displayed. This is called Globalization and is configured by Response.LCID or Session.LCID (for all responses).
More info about the localeID and how to set it: http://msdn.microsoft.com/en-us/library/ms525091(v=vs.90).aspx
I suspect an english or american locale sets the thousands separator with a comma.
EDIT
If you want more information on the parameters of FormatNumber, you can find them at the W3Schools FormatNumber reference.

Biztalk Flat File--Ignoring Headers and Footers

I believe I have a general understanding on the steps on how to do this, but am struggling to get the schemas correct, either using the Flat File Schema Generator or tweaking the config afterwords.
I will give a sample of the data below, but in general, it starts with a multi-line header that can have variable text but always ends with the same exact line ("START-OF-DATA"). The next section consists of rows of delimited data (this is the only part of the file I need to bring into Biztalk). Finally, there is a multi-line footer that always has the same start end end line ("END-OF-Data" and "END-OF-FILE").
Sample--my comments are in parens:
START-OF-FILE (this is always here)
(. . . variable number of lines that contain info I don't need . . .)
START-OF-DATA (this is always here)
(many lines of delimited data that I DO need)
END-OF-DATA (this is always here)
(. . . variable number of lines that contain info I don't need . . .)
END-OF-FILE (this is always here)
I have used the flat file generator to create three schema (header/detail/footer) with the intent to map only the detail. I created a pipeline and assigned the three schemas to the disassembly stage.
I am looking for general tips on what may be wrong with my approach, or what I should be looking out for. However the error I get when running this is:
The trailer specification specified on the pipeline component
properties does not contain an interchange trailer.
I have googled this error and (as suggested) tried to change the Child order from Infix to Postfix, but this didn't help.
I think this blog should help you:
http://maddcoder.wordpress.com/2012/06/14/using-biztalk-to-parse-a-flatfile-with-multi-line-header-and-trailers/

Resources