Concatenation of expressions


https://www.nevron.com/Forum/Topic3655.aspx
Print Topic | Close Window

By AlexK - 14 Years Ago

Hi All,

I'm trying to concaternate some expressions, like this:

=YEAR(Fields!DateTime)+"some text"

what i get is this: <Array(1,1,1,1,1,1........)>some Text

what is the issue?

 

Best Regards,

Alex

By Nevron Support - 14 Years Ago
Hi Alex,

Depending on the scope in which the expression is evaluation the Fields!DateTime variable will return the values in the data time column, for the records that are in the scope recordset.

What exactly are you trying to achieve and where is this expression placed.

By AlexK - 14 Years Ago

Hi,

I have a DateTime (source is a SQL Table) column and want to get an output like "[Year]/[Month]"

 

Best Regards

 

Alex

By Nevron Support - 14 Years Ago
Hi Alex,

It is clear that you have a DateTime column, but where is the expression placed - at a chart title, chart values data grouping, chart category data grouping etc.? Also what is your pivot configuration? Please provide us with more info.
By AlexK - 14 Years Ago

Hi

attached is a screenshot of the field with the formula. I hope it helps to understand the issue.

Best Regards, Alex

By Nevron Support - 14 Years Ago
Hi Alex,

The screenshot clarifies the task. Lets assume that you have this data set:

DateTime (format is day/month/year) Value

1.2.2010 10
2.2.2010 11
1.3.2010 12
2.3.2010 13
1.2.2009 14
1.3.2009 15

We assume that you want to display a sum of the values for each distinct month in each year.
To do that you need to follow these steps:

1. Make a single Category grouping (not series grouping), with the following TWO group by expressions:

=MONTH(Fields!DateTime)
=YEAR(Fields!DateTime)

This is necessary, because if you simply group by month the records for January 2009 and January 2010 will be in the same group - e.g. each category group will actually contain data for a single month for all years.

2. Set the category label to be:
=MONTH(FIRST(Fields!DateTime))+"/"+YEAR(FIRST(Fields!DateTime))

This expression will display the Year/Month for the current group. Because all records in the group are having the same year and month you only need to get the first date time value in the group in order to make the category label.

3. Create a single values data grouping with Value expression set to:
=SUM(Fields!Value)

Assuming that you started with the default chart (e.g. either from a blank web part or by pressing the RESET button), this should create a bar chart with the following data:

Category Label Value
2/2010 21 (sum of records 1 and 2)
3/2010 25 (sum of records 3 and 4)
2/2009 14
3/2009 15

By AlexK - 14 Years Ago

That's is, thank you!

Best Regards,

Alex