Add Days or Months to a date?
Hey there - first post here...love FR4!
First off - am using FR v4.10.1
OK...I'm trying to simply add either months or days to database date and I've tried all kinds of ways, but just can't figure it out. Some examples I tried:
[frxDBRep."repDate"]+180
[frxDBRep."repDate"]+(180)
[[frxDBRep."repDate"]+(180)]
frxDBRep."repDate"]+[180
....all to no avail. [img]style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> So doing a search here in the Forum...came across a post in the .NET forum and come to find out there is a function "AddMonths" in the .NET version (and other similar ones) that easily can do this:[/img] http://www.fast-report.com/en/forum/index....mp;hl=addmonths
So...is there a way to do this in FR4? So according to that thread...if I were to do this in the .NET version and add 6 months, should look something like this:
AddMonths([frxDBRep."repDate"],6)
On the same note - will FR4 ever get those extended functions that .NET version of FR has?
Thanks!
Fred
First off - am using FR v4.10.1
OK...I'm trying to simply add either months or days to database date and I've tried all kinds of ways, but just can't figure it out. Some examples I tried:
[frxDBRep."repDate"]+180
[frxDBRep."repDate"]+(180)
[[frxDBRep."repDate"]+(180)]
frxDBRep."repDate"]+[180
....all to no avail. [img]style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> So doing a search here in the Forum...came across a post in the .NET forum and come to find out there is a function "AddMonths" in the .NET version (and other similar ones) that easily can do this:[/img] http://www.fast-report.com/en/forum/index....mp;hl=addmonths
So...is there a way to do this in FR4? So according to that thread...if I were to do this in the .NET version and add 6 months, should look something like this:
AddMonths([frxDBRep."repDate"],6)
On the same note - will FR4 ever get those extended functions that .NET version of FR has?
Thanks!
Fred
Comments
[frxDBRep."repDate"]+180
change to
[(<frxDBRep."repDate"> + 180)]
fr4 has all kinds of functions and there is also an additional function lib on Stalkers site
and you can also write and add your own function libs.
thanks alot for the quick reply as well....I saw it when you posted it and then something came up that tied me up for the rest of the day, but really appreciate you getting back to me so damn quick. [img]style_emoticons/<#EMO_DIR#>/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> Cheers, Fred[/img]
For example this is how it is returning +180 days.
Report Date = July 9, 2006
+180 days later returns = January 5, 2007
6 months should really be January 9, 2007.
Is there any way I can fix this in Fast Report? If not....can I do the calculation in Delphi code (before previewing the report) so to pass the variable (6 month date) to the report for the 6 month date?
Thanks for any help!
http://www.delphibasics.co.uk/RTL.asp?Name=IncMonth
http://stalker4.dp.ua/en/
OK, I downloaded the "frxAddFunctionLibrary 4.51" library and tried to install the "frxAddFunction14.dpk" package which seems to be the latest one since I'm using Delphi XE, but I'm getting an error message when I try to Install it (Builds fine though):
Error
Cannot load package 'fs14.' It contains unit 'fs_tree', which is also contained in package 'fs15'.
OK
I also tried copying some of the *.pas files starting with the "date" function one until my app could compile, but I still can't get the function to work as it says it does not recognize the function "IncMonth" or "frIncMonth".
So...I'm at lost here already gordk, so appreciate if you have any idea on how I can get this to work in Delphi XE. [img]style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> BTW - I've got FastReport v4.10.1 installed (in Delphi XE) Thank you!![/img]
All what you must do is to take care of last day in different months (28,29,30,31)
Mick
you should be able to rename all the pgks of the function lib to 15 and any refrences to in pas files to from 14 to 15
then recompile and install.
"frxAddFunctionLibrary 4.51" package actually DOES install fine in Delphi XE, you just need to remove the reference to "frx14.dcp" in the Package and once you hit Build, it comes up asking to add a 4 or 5 other components in which before I must have clicked "Cancel", but clicking "OK"....and Building/Compiling it and Installing it....it worked just fine.
I got it working as well by just throwing all the *.pas files to my main app directory and adding them all to the top uses clause. The nice thing about installing the Package is that it adds those functions to the Expression Editor, which is cool.
gordk- is there any chance to make those functions/components on Stalkers' page - a permanent part of FastReport? I don't see why they can't just be incorporated into FR especially since it looks like those components/functions are mature and have been around since v2. Obviously I don't know the relation between FR and Stalker....but whatever, thank you so much for the link.....it got me back in business here!! LOL
So to help others, here is the final code I used in the Script page of this particular report I'm working on.
Thanks again guys!
Cheers