hen using blogger, I sometimes have to put javascript into the blog post. In order to do this, I have to HTML encode it.
My favorite HTML encoder:
http://www.opinionatedgeek.com/DotNet/Tools/HTMLEncode/Encode.aspx
And just to be safe, here is my favorite URL encoder:
http://www.w3schools.com/tags/ref_urlencode.asp
joi, aprilie 26, 2007
HTML Encoder
Views Filtered by URL Parameter
These views are wonderful, however, when people bookmark them or stumble upon them without a URL parameter, they are nonsense.
So we use some javascript to let the user know that they have come into the page by mistake.
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];
}
}
alert('This page is for viewing a filtered report. Please return to this page with a valid filter.');
}
var IntRecordID = getQueryVariable("ID")
This will alert the user that they have come to the page without a Querystring variable and that they need to go back and rethink what they are trying to do.
Etichete: Filter, JavaScript, List, SharePoint, WSS, XSLT Data View
miercuri, aprilie 25, 2007
Calculated Field: Quarters
The Company has a fiscal year that starts on June 1. I need a field in my list that shows what quarter and year this date falls in, so that I can sort/filter by that data instead. The Company Fiscal Quarters can be calculated.
Create a new field, calculated, and put this formula in:
=IF(MONTH([TheDate])<=6,YEAR([TheDate]),YEAR([TheDate])+1)&" Q 0"&MOD(CEILING(22+MONTH([TheDate])-5-1,3)/3,4)+1
If you are trying to do a different fiscal, change the 5 to whatever month is the last month of the quarter, and change the 6 to the first month of the quarter (november in this case):
=IF(MONTH([TheDate])<=11,YEAR([TheDate]),YEAR([TheDate])+1)&" Q 0"&MOD(CEILING(22+MONTH([TheDate])-10-1,3)/3,4)+1
You can modify it by removing the year, which will just give the quarter number (november in this case):
=MOD(CEILING(22+MONTH([TheDate])-10-1,3)/3,4)+1
And of course, you can create another field that will just give you the fiscal year (november in this case):
=IF(MONTH([TheDate])<=11,YEAR([TheDate]),YEAR([TheDate])+1)
Have Fun with this new information!
Despre mine
- Ophogus G. Marmphik
- Timi-Ostravia, Republic of Czedvia, Bulgaria
- I make web applications. The tools I use are many and far between. I have been maining to learn Ruby and Python, and Perl. These tools are all like Lego to me. They can all be make to build things and have their strengths and weakest.