Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How can 'inherited' be used for an alternate state in a variable?

Hi,

In Thread How to use a parameter in a variable to use an alternate state in set analysis I ask a question about using alternate states in variables. This question is answered and it is working for named alternate states:

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.

But now I face the problem that I cannot use this formula with inherited alternate states.

That means instead of using the named alternate state 'Machine1'

I want to use the alternate state <inherited>.

So far I could not find any possibility to use <inherited> as parameter. I tried the following combinations:

  1. Variable without parameter:  =$(fTotalDuration)
  2. Variable with empty parameter:  =$(fTotalDuration(''))
  3. Variable with parameter '<inherited>':  =$(fTotalDuration('<inherited>'))
  4. Variable with parameter <inherited>:  =$(fTotalDuration(<inherited>'))
  5. Variable with parameter '$':  =$(fTotalDuration('$'))
  6. Variable with parameter $:  =$(fTotalDuration($))

So the final question remains: How can 'inherited' be used for an alternate state in a variable?

Regards

Dirk

1 Solution

Accepted Solutions
Not applicable
Author

Dear Stefan,

according to you explanation this will work then:

Instead of

set fTotalDuration= sum({$1} Duration)

I should use:

set fTotalDuration= if(len($1)>0, sum({$1} Duration), sum(Duration))

So the correct syntax with this formula is then:

=$(fTotalDuration('Machine1'),  when using alternate state Machine1

and

= $(fTotalDuration(''), when using the inherited state.

You are absolutely right, I have to ensure the right syntax in the variables. For me this  was not an obvious solution.

Thanks for your help.

Dirk

View solution in original post

19 Replies
sunny_talwar

How about this

=$(fTotalDuration(Chr(36)))

Not applicable
Author

Dear Sunny,

thanks for you answer, but this doesn't work.

Regards

Dirk

sunny_talwar

Tried this and it worked for me

=$(fTotalDuration('$'))

and also this

=$(fTotalDuration($(=Chr(36))))

swuehl
MVP
MVP

AFAIK, the dollar sign denotes the default state, not inherited state.

Inherited state would be a void set identifier, i.e.

// default set

Sum( {$<Field = {'A'}>} Value)

vs.

// inherited set

Sum( {<Field = {'A'}>} Value)

sunny_talwar

But seems to be working with selection in inherited state.... for what I have seen, I have never seen difference between Inherited state and default state. There may be some difference, but don't think it is $

Capture.PNG

Selection in Inherited and Default state list box go hands in hand....

swuehl
MVP
MVP

Seems like you inherited from default state...

Try using an alternate state in your sheet properties, then the text object will inherit from that.

Not applicable
Author

Dear Sunny,

both do not work, see attached file.

I forgot to mentioned, that sheet belongs to an alternate state 'Mac !hine 1'.

If you change this, then inherited won't work.

Regards

Dirk

swuehl
MVP
MVP

Seems to work with

=$(fTotalDuration(<Field>))

// used Field as a dummy field to create a valid syntax, would be better to create another variable proper syntax to avoid this

sunny_talwar

Not sure I understand, would you be able to modify my script to show how inherited state and default state differ? I always thought they are the same thing, but might have always been mistaken