Page 1 of 2

How to match two dates

Posted: Thu Oct 20, 2011 7:09 am
by Fabio Pagano
I need to match a datetime field (from the dictionary) with a fixed date. Eg. MyDateFromDictionary >= "20111020". Script report is in C#.

Thank you.

How to match two dates

Posted: Thu Oct 20, 2011 8:04 am
by Alex K.
Hello,

Sorry, maybe we did not exactly understand your question. Could you explain your issue in more details?

Thank you.

How to match two dates

Posted: Thu Oct 20, 2011 9:16 am
by Fabio Pagano
Sure. In my datasource i have a datetime column called "MyDate". In its field of the report, if "MyDate" is between two specific dates (eg. 01/01/2011 and 31/01/2011) i must print "x", else i must print "y".

I don't know how to create the IIF statement to see if the "MyDate" column is between the two fixed dates (i have tried several ways but with errors).

Thank you.

How to match two dates

Posted: Fri Oct 21, 2011 3:05 am
by HighAley
Hello.
Fabio wrote:Sure. In my datasource i have a datetime column called "MyDate". In its field of the report, if "MyDate" is between two specific dates (eg. 01/01/2011 and 31/01/2011) i must print "x", else i must print "y".

I don't know how to create the IIF statement to see if the "MyDate" column is between the two fixed dates (i have tried several ways but with errors).
Please, try to use variables. See attached report template.

Thank you.

How to match two dates

Posted: Fri Oct 21, 2011 6:28 am
by Fabio Pagano
My intention was to write, in the field, the fixed value of the date, example:

{MyDate>"20111031" && MyDate<"20111001"?'Y':'X'}

but this raises the compilation error:

"Unable to apply operator "<" to operands of tpye "System.DateTime" and "string"."

This is correct, because the two operands are different: i have tried to convert one type to another but i have had other errors. So at this point i need to know how to convert the date in string or the string in date.

Thank you.


How to match two dates

Posted: Fri Oct 21, 2011 7:07 am
by HighAley
Hello.
Fabio wrote:My intention was to write, in the field, the fixed value of the date, example:

{MyDate>"20111031" && MyDatenew DateTime(2011,10,31) && MyDate < new DateTime(2011,10,01)?'Y':'X'}

Thank you.

How to match two dates

Posted: Fri Oct 28, 2011 6:42 am
by Fabio Pagano
I have tried, in a group footer, the following expression:

{Sum(Movimento.Movimento__Data_documento> new DateTime(2010,01,01) && Movimento.Movimento__Data_documento< new DateTime(2012,12,31)? 1 : 2)}

but the following error appears:

"The name "newDateTime" does not exists in the current context" (Note 1: i have translated the message from Italian - Note 2: in the error message, "newDateTime" appears without spaces).

Thank you.

How to match two dates

Posted: Mon Oct 31, 2011 6:23 am
by Alex K.
Hello,

Please send us your report with test data for analysis.

Thank you.

How to match two dates

Posted: Thu Nov 10, 2011 6:14 pm
by Fabio Pagano
I have sent the data and the report to support@stimulsoft.com.

Thank you.

How to match two dates

Posted: Thu Nov 10, 2011 10:37 pm
by Andrew
Thank you, Fabio.