TOPIC: Date variable in pro version

Date variable in pro version 14 Aug 2009 05:59 #503

  • wanless
  • wanless's Avatar
Hi,

We would like to know if it's possible to do something like date (day - 3) for the date parameter in the pro version.


Thanks
Travis
The administrator has disabled public write access.

Re:Date variable in pro version 14 Aug 2009 12:12 #505

  • aellis
  • aellis's Avatar
Travis,

Unfortunately, we don't support any sort of formulaic manipulation of our date variables at this time. It is on our feature request list, but is going to take a significant re-write before we can implement something like that. In the meantime, I always recommend that customers develop something in their select expert within Crystal to accomplish the desired result. For example, in your select expert, write a formula something like this:

{FIELD.NAME} = CurrentDate - 3

Hope this helps,
Adam
The administrator has disabled public write access.

Re:Date variable in pro version 02 Aug 2012 14:16 #1057

  • sduranceau
  • sduranceau's Avatar
  • Offline
Hello!
Now in Logicity 1.7, this is easily do-able, using VBScript in your variables.
To do this, under the Display Name tab in Solution builder, enter your VBScript command inbetween a "%{" and a "}%".
For example, if you wanted the current date - 3 days, you would enter the following: "%{Date - 3}%"



Now, when you run your solution file, the Display Name will show the current date, subtracted by 3 days.
I hope this helps!
-Devin
Attachments:
Last Edit: 02 Aug 2012 14:16 by sduranceau.
The administrator has disabled public write access.

Re:Date variable in pro version 07 Nov 2012 08:11 #1213

  • richardh9999
  • richardh9999's Avatar
  • Offline
Can I use any kind of dynamic parameters in the report scheduling - such as variable parameters that automatically selects the first day of last month to the last day of last month?
The administrator has disabled public write access.

Re:Date variable in pro version 07 Nov 2012 14:06 #1214

  • aellis
  • aellis's Avatar
  • Offline
Yup, you can absolutely use our new VB Script layer to handle this sort of request. This can look a little wild if you are not used to VB script but it works. Here is what you would put in place for a variable where you wish to pull the first day of last month:

%{DateSerial(DatePart("yyyy",DateAdd("m", -1, Date)),DatePart("m",DateAdd("m", -1, Date)),1)}%

Putting this into human, we are forming a new date (DateSerial) using the year portion of last month (which we determine by taking the current date and subtracting 1 month using DateAdd), the month portion of last month using the same technique, and filling in 1 for the day.

And here is one where you grab the last day of last month:

%{DateAdd("d", -1, DateSerial(DatePart("yyyy",Date),DatePart("m",Date),1))}%

Putting this into human, we are subtracting 1 day from a date we created by taking the current year, current month, and 1 for the date.

These could have possibly been simplified if you didn't care as much about making it correctly handle a transition from one year to the next but the way it is written here should work in that scenario correctly.
The administrator has disabled public write access.

Re:Date variable in pro version 07 Nov 2012 14:31 #1215

  • richardh9999
  • richardh9999's Avatar
  • Offline
So how can I test Logicity Pro please?
and where exactly would I put this script?
The administrator has disabled public write access.

Date variable in pro version 07 Nov 2012 14:44 #1217

  • aellis
  • aellis's Avatar
  • Offline
If you would like to test out Logicity Pro just e-mail your company name and contact into to This email address is being protected from spambots. You need JavaScript enabled to view it. and we can make up a demo license for you.

With regards to where you place these scripts - it would go within your Logicity Solution File where you define the parameters. If you want to see an example download the two attached files here and place them at the root of your C: drive. Double click on the RRD and you will see an example of the scripts in action. We also have a video of the 1.7 features on the home page you can watch for more info on this feature.
The administrator has disabled public write access.