Cascading parameters
Hello folks.
Does Pyramid have the ability to build cascading parameters? I would like to have a text parameter control the output of two independent numeric parameters.
Cheers, Dave
4 replies
-
Hi Dave,
The answer is broadly, yes, but if you can provide an example, of what you want to achieve, I can show how that might be implemented.
Cheers,
Ian
-
Ian, great to hear from you.
So my context is an attempt to handle calendar year and fiscal year date ranges. If I can input a start date and an end date (or some equivalent in my data) then I can handle any date range, as long as I have stored integers which describe these ranges. I suppose the nuance is that calendar year periods are referenced to current date and fiscal year periods are referenced to start of fiscal year.
So, if we have the following record of start and end integers that I can use with range() and lag() functions in building the ultimately parameterized date rangeand with the following mappings of the paramerters:
Parameter 1 (T)
1 w/e -> 1 w/e
4 w/e -> 4 w/e
Q1 -> Q1
MTD -> MTDParameter 2 (#)
1 w/e -> 0
4 w/e -> 0
Q1 -> 9
MTD -> 5Parameter 3 (#)
1 w/e -> 0
4 w/e -> 3
Q1 -> 23
MTD -> 23I hope that makes sense and there's enough context.
Cheers, Dave
-
Hi Dave,
You can't cascade global parameters in that fashion, there is no mechanism to set the value of one global parameter directly from another.
However, what you can do is set the value of two Measures from the parameter and use those in the Range() or Lag() functions.
Create a Global Parameter as you have defined:
Then create 2 Measures, Start, End, where we derive their value using Case Logic using the mapping you provided above:
You can then use these Measures as arguments in your Range() and Lag() functions. You can see how their Values are driven from the Parameter here:
Hope that helps.
Ian
-
Ian, that's a great solution and really helps.
When I was driving on Friday evening I was thinking about this and whilst I wasn't thinking of your CASE proposal I was trying to work out if I could get a parameter linking to a 3-level regular hierarchy, with the levels being 'range name', 'start' and 'end'. The parameter would be a text parameter mapping to 'range name'. I was attempting to use hierarchical functions to navigate the hierarchy. The values for 'start' and 'end' will need to be dynamically controlled but that's a different issue. I can still do this with CASE.
I'm presuming it should be possible to build a model parameter which is referencing values within a regular hierarchy which would offer subsequent navigation as per my musing above?
Many thanks for the help here.
Cheers, Dave