Display Month Name Instead of Month Number In Crystal Report - crystal-reports-2010

How Can I display Month Name Instead of Month Number (Not Data Format Number) In Crystal Report?

The MonthName function can be used to display the name of the month, when you provide a number between 1 and 12 (1 being January). It is useful for showing the month name in Group titles or labeling groups in charts.
It can be combined with the DatePart function to return the month name of a variable or calculation.
Syntax
MonthName(month, abbr)
Month A number from 1 to 12.
abbr Optional.A Boolean value. If true, the month name is abbreviated. The default is false.
Examples
Example Result
MonthName(5) “May”
MonthName(10) “October”
MonthName(10,True) “Oct”
MonthName(DatePart(“m”, CurrentDate)) “October” when the current date is 10/5/10.

Related

SSRS Report expression setup

I have a dataset with 4 fields (Date,SeccurityName, FiledName, Value). In my dataset query I filter the data to bring only records with a specific value in the filed name(Last Price). Following is a sample of my dataset
Date SecurityName FiledName Value
5/5/2016 A LastPrice 20.01
5/6/2016 A LastPrice 19.8
5/7/2016 A LastPrice 19.9
5/5/2016 B LastPrice 43.1
5/6/2016 B LastPrice 43.5
5/7/2016 B LastPrice 43.7
In this dataset I have data for each security for each business day for the last 5 years.
In my report I need to show in a table The security name , the last value, the value from a month ago, the value from a year ago and the value from three years ago
Security name LastPrice 1M 1Year 3Years
A 20.1 18.8 19.01 16.05
I would appreciate if someone can give me the best way to build this format.
I would group your table on the Security Name. This would aggregate all records with the same security name on the same line.
Then for each date/value column, create an IIF statement to filter for the date that you want:
=MAX(IIF(Fields!Date.Value = Parameters!LastDate.Value, Fields!Value.Value, NOTHING))
The Last Month (and other dates) would be similar:
=MAX(IIF(Fields!Date.Value = DATEADD("M", -1, Parameters!LastDate.Value), Fields!Value.Value, NOTHING))
The MAX is used to aggregate the NOTHINGS with the Values.
I think it would be best to have the Last Date as a parameter (with a default of yesterday?) to make it easier to create the expressions and you would also have the ability to look at past dates if you ever have the need.

print a calendar for a given date in Ruby

I am trying to create a method that takes user entered month and year and prints out an accurate calendar for the month and year. I am about halfway through but have no idea how to move on.
The guidelines Below in Bold is where i am having issues
Determine the beginning of the next month. Calculate the last day of the month by doing the following: Get the next month date, now get the previous day of that next month. Print the Calendar heading for the full month name and year. Print the header row that contains the abbreviated name of the days of the week. Create an array with a length of 7 and a default value of 4 spaces (" ").
Using the date range from the beginning of the month to the end of the month do the following:
Get the numerical representation of the day of the week using the" %w" formatter and convert to an integer. (This will be the index to the array.)
Use the index to set the day of the month within the array, using the "%d" formatter to get the day of the month.
If index equals 6 OR the date equals the last day of the month, then do the following:
Loop through the array
Print the day of the month
Print a blank line Re-initialize the array so that all values are of 4 spaces
def printMonth(year, month)
now= Date.new(year, month, 1)
a= now >> 1
b= a - 1
puts("Calendar for: #{b.strftime("%B, %Y")}")
puts("")
puts("Sun\tMon\tTue\tWed\tThu\tFri\tSat")
days= Array.new(7," ")
c= b.strftime("%w").to_i
end

d3.js - Timestamp based on year and week

I have a column with data year&week. I would like to create a date axis based on this.
when i try to format the date, it is not working
I tried this:
var parseDate = d3.time.format("%Y-%W").parse;
d3.csv("temperatures_groups_2.csv", function(error, data) {
data.forEach(function(d,i) {
d.timestamp = parseDate(d.timestamp);
alert(d.timestamp);
d.temperature = +d.temperature;
}
});
i get null when the alert executes.
If i replace the same with d3.time.format("%Y-%m").parse, it works fine. It takes the month but not week no.
The csv contains data like this
timestamp,temperature
2013-01,19.5
2014-02,21.5
2015-03,20.5
2016-04,20.5
2017-05,21.25
The documentation says:
The following directives are not yet supported for parsing:
%U - week number of the year.
%W - week number of the year.
Hence you can't use D3 to parse these dates. You'll have to parse the date yourself or use another library, for example moment.js.
This works since version 3.2 and the documentation has been updated.
%U - week number of the year (Sunday as the first day of the week) as a decimal number [00,53].
%W - week number of the year (Monday as the first day of the week) as a decimal number [00,53].
However, the format in your question won't work because the parser requires a specific date to be specified. E.g. by "%a". It would be nice to assume Sunday in the absence of a date specifier, but that's for another PR.

How do I get the aggr of two aggrs in QlikView?

If I want to find the maximum value of a column from two states aggregated by a member's ID, should this work?
=Aggr(
MaxString(
Aggr(NODISTINCT MinString({[State1]}DATE_STRING),MBR_ID)
+
Aggr(NODISTINCT MinString({[State2]}DATE_STRING),MBR_ID)
) , MBR_ID)
So if I had this data:
MBR ID DATE_STRING
1 20120101
1 20120102
1 20120103
And State1 had 20120101 selected and State2 has 20120103 selected, my expression would return 20120103 for member 1.
Thanks!
Edit: In SQL, this would look like:
WITH MinInfo (DATE_STRING, MBR_ID)
AS (SELECT MIN(DATE_STRING), MBR_ID FROM Table WHERE TYPE IN ('State1', 'State2') GROUP BY MBR_ID, TYPE)
SELECT MAX(DATE_STRING) DATE_STRING, MBR_ID FROM MinInfo GROUP BY MBR_ID
It would be easier to accomplish your goal if you convert your that to an actual date field
Assuming that you are using a chart where MBR_ID is the Dimension, if you want the maximum date (latest date) you can do the following:
=nummax(Max({[State1]}DATE_STRING),Max({[State2]}DATE_STRING))
To convert to a date, you can use this function:
date#(DATE_STRING,'[text format of the date]')
(The date format looks like YYYYMMDD to me, but if its day then month, you would use YYYYDDMM)
I'd suggest you format it in the script, so that you wont have to worry about it every time you need to use that date.

How to show date in normal format in jqgrid when formatter is used

Date column is created using colmodel below.
This column shows values like 0101.0101.7070 for every date column.
if formatter:date is removed, date is correct.
How to show normal date values with formatter:date ?
{ "name":"Date",
"formatter":"date",
"datefmt":"dd.mm.yyyy",
"formatoptions":{"newformat":"dd.mm.yyyy"},
"editable":true
}
Update.
Data is passed from server using json in same dd.mm.yyyy format like
{"total":2,"page":1,"records":57,"rows":
[{"id":"9279","cell":["9279","42","","10.08.2011","","","","False"]},
{"id":"9278","cell":["9278","41","","12.08.2011","","","","False"]},
...
Using d.m.y formats in column options as suggested shows proper dates but with 2 year digits only..
I'm looking for a 4-digit year numbers. I tried d.m.yyyy format but this shows 8 digit year numbers and 1 for month and day as 01.01.70707070
I also tried to add srcformat: 'dd.mm.yyyy' to formatoptions but this does not change the wrong result.
To display the day as the number you should use j or d. For the displaying month as the number you should use n or m. The d and m includes 0 padding at the beginning if needed. The 'y' means two digit year format and Y means four digit year.
So you probably need srcformat: 'd.m.Y' or srcformat: 'j.n.Y'.
Use d.m.y instead of dd.mm.yy ,

Resources