Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

update parameter changes as soon as another parameter Expand / Collapse
Author
Message
Posted Monday, April 15, 2013 7:52 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, March 20, 2014 10:26 AM
Points: 24, Visits: 109
I have a parameter in vai get today's date and have another parameter that will get the date one year ago. So far so good. But I would like to click on the calendar for today's date and moved to a date yesterday for example another parameter also would change automatically?

Parameter today = CDate (Format (DateAdd ("d", -1, now ()), "MM / dd / yyyy 1:00"))
parameter year ago = CDate (Format (DateAdd ("d", -365, now ()), "MM / dd / yyyy 1:00"))
Post #1442306
Posted Tuesday, April 16, 2013 7:05 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, April 18, 2014 6:52 AM
Points: 286, Visits: 176
I am going to have to assume that the second parameter is hidden, otherwise this would appear to be near impossible (or extremely complicated), since whatever logic you use will be based on the value in the 1st parameter.

For the 2nd parm, set your default value based on the other parm's value, like so:
=DateAdd(DateInterval.Day,-365,Parameters!StartDate.Value)

That's it. The other way this could be accomplished would be to use a global variable (the value of the 1st parm again), but this method for the scenario you described is much easier.



Post #1442723
Posted Tuesday, April 16, 2013 8:03 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, March 20, 2014 10:26 AM
Points: 24, Visits: 109
yes the other field is to stay hidden.
I put the following code = CDate (Format (DateAdd ("d", -364, Parameters! DataA.Value) "MM / dd / yyyy 1:00"))
But when I change the parameter DataA the above code does not change anything. gives the feeling that no updates
Post #1442754
Posted Tuesday, April 16, 2013 8:10 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, April 18, 2014 6:52 AM
Points: 286, Visits: 176
You do need to refresh the report after changing a parameter. To prove whether it is working or not, temporarily display the parameter fields in the body of the report until it works as desired. Good luck.
Post #1442762
Posted Tuesday, April 16, 2013 8:16 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, March 20, 2014 10:26 AM
Points: 24, Visits: 109
But is there any command to refresh the Paramenters. Or is just to say f5 (refresh)?
Post #1442768
Posted Tuesday, April 16, 2013 8:35 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, April 18, 2014 6:52 AM
Points: 286, Visits: 176
amadeu_j, I appologize, but I just tried this and this creates a "forward depenency" error message (I thought that I have done this in the past, again, sorry for misleading you).

The best solution is to alter your SQL, basically the same way you attempted to adjust the 2nd parameter. Something like:

WHERE columName BETWEEN @Parm1Date and DATE_ADD(year, -1, @Parm1Date)

since all your really need is to work off of one date.


Post #1442777
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse