Page 1 of 1

Calculating Dates

Posted: Wed Dec 20, 2017 7:20 pm
by JohnW
I need to add and subtract dates

I created an expression and tried to use a VB expression. I need to add one day to the Expired Date to create a new start date.
NewStart =ExpiredDate.AddDays(1)

I then need to add 365 days to the Expired Date to get a New End date
NewEnd = ExpiredDate.AddDays(365)

The users manual says I can use VB expressions in a VB report. However, all I find are errors and the AddDays function is not part of Date,etc.

I have added Microsoft.VisualBasic.dll to the registered assemblies. Still no success.

How do I add and subtract dates in Stimulsoft Reports?

Re: Calculating Dates

Posted: Thu Dec 21, 2017 5:54 pm
by JohnW
The only way I found to do this was in the data query. That works but it does seem that you should be able to to add and subtract dates on the report side.

If someone has the syntax, and can tell which report object to use (expression, calculated column, etc.) to place it I would appreciate the information.

Re: Calculating Dates

Posted: Thu Dec 21, 2017 9:08 pm
by HighAley
Hello.

The AddDays() function is working right in our product.
You don't nee to add any assemblies.
Maybe we missed something. Could you send us a sample that will help us to reproduce the issue?

Thank you.

Re: Calculating Dates

Posted: Fri Dec 22, 2017 5:56 pm
by JohnW
I am placing this in an expression
AddDays({liqBrand.Mand},1)

{liqBrand.Mand} is a date field.

It is not working.

Re: Calculating Dates

Posted: Sat Dec 23, 2017 7:50 am
by Alex K.
Hello,

Please try to use the following expression:
{liqBrand.Mand.AddDays(1)}

Thank you.

Re: Calculating Dates

Posted: Sat Dec 23, 2017 2:24 pm
by JohnW
Thanks that works! I must have placed the curly brackets in the wrong places. Is there an available list of the date and other functions? I have not located one and it would be a useful reference for me.

Re: Calculating Dates

Posted: Tue Dec 26, 2017 7:13 am
by Alex K.
Hello,

In the NET versions you can use any NET framework methods:
https://msdn.microsoft.com/en-us/librar ... .110).aspx
https://msdn.microsoft.com/en-us/librar ... .110).aspx
etc

Thank you.