Visio Guy

Visio Discussions => Programming & Code => Topic started by: Ashok on November 15, 2010, 04:23:29 PM

Title: Sum across different shapes
Post by: Ashok on November 15, 2010, 04:23:29 PM
Hi,

I have created a process diagram and included values for 'Duration' for each of the process steps. On the same diagram I would like to include a field to sum all the durations of the individual steps on that sheet. I can insert a formula to add indiviual shapes (e.g. =Process.78!Prop.Duration+Process.60!Prop.Duration) however I don't want to update the formula each time I add a new step. Is there a way to sum all shapes on a sheet to pull the total duration of a complete process?

Thanks,
Ashok
Title: Re: Sum across different shapes
Post by: vojo on November 15, 2010, 05:54:35 PM
Assuming you dont want to use VBA

Use some user cells in the page.
Use some props cells and user cells in the given shapes

User cell keeps the running total

Props cells coordinates who goes when

In each shape....something like this in the shapes, key user cell...basically gives you the idea of the shape cells / page cells needed

     user.addminetothemix = If(props.mytimeslotid = thepage!user.timeslot, setf(getref(thepage!user.sum),user.sum+props.myslotvalue) + setf(getref(thepage!user.timeslot),thepage!user.timeslot+1),)

Probably need a shape to reset timeslot back to 0 / doubles as "recalculate" button...something like a shape or button with
     eventdbldclk = setf(getref(thepage.timeslot), 0)

I think this gives you the general idea

you may want to do things like step the mytimeslotid in increments of 10s so you can add shapes in the middle if you need to.
     
Browser ID: smf (is_webkit)
Templates: 1: Printpage (default).
Sub templates: 4: init, print_above, main, print_below.
Language files: 1: index+Modifications.english (default).
Style sheets: 0: .
Hooks called: 48 (show)
Files included: 25 - 925KB. (show)
Memory used: 747KB.
Tokens: post-login.
Cache hits: 8: 0.00169s for 22,301 bytes (show)
Cache misses: 2: (show)
Queries used: 11.

[Show Queries]