Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear Community,
I have read about alternate states, variables and parameters. But I have diffuculties in the correct use. The following is an example, the real formulas are more complex.
I have defined a variable with a formula that uses set analysis:
This formula is used on seperate sheets like $(vPossibleTime1) , but there will be different alternate states in the sheets, e.g: state1 and state2.
The charts on the sheets are set to one of these alternate states in the properties dialogue. When I use the alternates the set analysis does not include the alternate state even if it is set in the properties. So I have to extend the formula:
So this works now for one sheet, for the other sheets I cannot use it because the alternate state is fixed in the formula.
No I tried to use a parameter in the definition of the variable:
After several trial and errors I found out that I now can use a formula like $(vPossibleTime3('$')) , $(vPossibleTime3('state1')) or $(vPossibleTime3('state2')) in the different sheets.
I expected a formula like $(vPossibleTime3('[state2]')) but this does not work.
Now I want to now if this is the correct syntax:
Furthermore I have some nested formulas, i.d. one formula with parameters is used in the other like:
together with the Parameters this looks like:
With this I can use a formula like $(vAvailableTime2('state2')) in the sheets. In the tests it seems to work.
But before I change the formula in all sheets I want to make sure that this is the correct procedure.
Who can answer this question?
Thanks for your help
Dirk
The following syntax ist working:
set fTotalDuration=(sum({$1} Duration)
In the diagrams you can use the formular like =$(fTotalDuration('Machine1')).
'Machine1' is the defined alternate state.
Best regards
Dirk
I think your approach should work. I'm not absolutely sure how alternate states will be handled as parameter within variables but I assume the same like by fieldnames and this meant you don't need single-quotes to references them. This meant: $(vPossibleTime3([state2])) and $(vPossibleTime3(state2)) should work.
Beside them I think you could simplify your variable-expression from:
set vPossibleTime1=sum(duration)-sum({$<reason={1,2}>}duration);
to
set vPossibleTime1=sum({$<reason -= {1,2}>}duration);
Further it might be useful to replace the reason-values of {1,2} or {3,4} also with a parameter whereby the use of a comma-list within a variable-parameter is problematic - but in some cases it worked, see for example: Re: Aggr with Two parameter Variable not working.
- Marcus
The following syntax ist working:
set fTotalDuration=(sum({$1} Duration)
In the diagrams you can use the formular like =$(fTotalDuration('Machine1')).
'Machine1' is the defined alternate state.
Best regards
Dirk