Auto draw batch process wrt run times

Started by visio, April 20, 2010, 02:36:07 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

visio

Dispite numerous attempts seems unable to get ThePage properties to map to the value of the properties of a shape, though this can be done the other way round. After a rethink the solution was to put the _B process at the top of the mini sheet and make its

PinY=(ThePage!Prop.StartHeight).

This puts the first process at the top of the page regardless of what time it started.

Subsequent process will have to be placed on the page a locations relative to this start shape. Relatively simple. The start shape had its name changed to something sensible (in this case the actual name of the process) as easier to work with than shape.14.

The PinY for subsequent shapes is similar to the big diagram only time is relative to the start of a session rather than the start of the batch. With the new data format there is now a Run_notrun property on each shape so the shapes that don't run can be made invisible and placed at default position at the top of the diagram (thus the if part in the PinY below). As Jumpy mentioned before 1 is in fact TRUE so the if statement is quite simple.

PinY=GUARD(IF(Prop.Run_notrun,ThePage!Prop.StartHeight,ThePage!Prop.StartHeight+(START_PROCESS_B!Prop.Start_time-(Prop.Start_time))*ThePage!Prop.Scale))

To make shape invisible when not run

In Geometry1 section NoShow cell =IF(Prop.Run_notrun,TRUE,FALSE)
and
in Miscellaneous section HideText=IF(Prop.Run_notrun,TRUE,FALSE)

To complete the invisibility go to View menu then uncheck show connectors and Robert is your fathers brother.

Next bit the repetive task of creating 95 mini diagrams and hyperlinking them to the main batch diagram. Shouldn't be too bad as the tricky stuff should be done now.


Jumpy

#31
Quote from: visio on July 07, 2010, 10:13:00 AM
Dispite numerous attempts seems unable to get ThePage properties to map to the value of the properties of a shape, though this can be done the other way round.

Why is this a problem? I tested it with a simple Box shape. Gave it the Prop.Test with value 20.
Then looked up it's true name wich was Box.1.

Then I made an entry in the ShapeSheet of the page Prop.Testdisplay and put in the value column the formula =Box.1!Prop.Test

And that worked.
In your version it would be:
ThePage!PropStart_TIME:     =Uproc!Prop.Start_time (with (Uproc=Session1_B)
Maybe you have to look up true name of the shape.

-------------

Or didn't I understand the true problem?


Maybe you could post a picture of the current state of things.

---------------

Do you have sth. like a timeline shape on one side as a kind of legend?

visio

No you understood the problem fine. The solution I came up with does the job and also forces me to ensure that the Begin and End Shapes are named correctly making future troubleshooting easy and also means that I now have Templates for start, end and normal processes. All very future proof.

Working on the remaining mini visio diagrams and hyperlinks working a treat.

Also got a line shape on the mini diagrams to indicate the start and end times on the text of the line, derived from the value of a shape property. No obvious to do this but found a way. Need to create a section called Text Fields in the shapesheet. Easy way is to do the following

-ensure that the name of the shape to be referenced is know (check format special on that shape and remember or change name to something sensible)
-make a line
-select the line
-menu (at top of visio) insert > field (a window opens)
-select custom formula (as using time referenced from other shape)
-make formula equal to desired value in this case =(EndProcessName!Prop.End_time)
-make sure format is correct for the property selected in this case {{HH:mm}}

The time will now be displayed as a label on the line. Now on the shapesheet of the line you will notice a new section called 'Text Fields' with this infomation.

Will post something soon, probably a cut down version for simplicity.

Jumpy

Quote from: visio on July 07, 2010, 10:13:00 AM
In Geometry1 section NoShow cell =IF(Prop.Run_notrun,TRUE,FALSE)
and
in Miscellaneous section HideText=IF(Prop.Run_notrun,TRUE,FALSE)

Just seen, this statement could although be easier with
NoShow cell = Prop.Run_notrun
and
HideText = Prop.Run_notrun

because as you said yourself, Prop.Run_notrun is either interpreted as True or False.

visio

#34
Retried mapping page properties to shape properties but still getting formula error.

Wanted to adjust the scale of the drawing to fit a page 400mm in height.

(End time of end process - Start Time of begin Process) X Scale = 400 mm

                                           400
Scale = -----------------------------------------------------
          (End time of end process - Start Time of begin Process)

So in the scale property the value should be =Prop.pageHeight/(End_process!Prop.End_time-Start_process!Prop.Start_time)

However all that is happening is a formula error. Even tried to map this to just the value of a shape property.

scale = Start_process!Prop.Start_time

But to no avail. Checked the correct name of the shape being referenced in the page shapesheet and the name was correct. (from before the _B and _E names were deliberately changed to make referencing easier)

Its either a bug or quirk of Visio or I've missed something fundamental.

Just to be sure not going mad too, tried the same reference formula and used this on a property in a different shape and the value worked out fine, its just in the page shapesheet...hmmmm (head scratch)

Not really that big a deal just more for visibility and in the webpage there are no scale marking (squared background) and the zoom function will do the needfull.

Jumpy

Quote from: visio on July 09, 2010, 02:21:32 PM
But to no avail. Checked the correct name of the shape being referenced in the page shapesheet and the name was correct. (from before the _B and _E names were deliberately changed to make referencing easier)

That means, it won't work, even if you simply put in a cell of the PageSheet:
=End_process!Prop.End_time
?

Then it can only be a problem with the name, I think. There is often trouble with the name. For example, if you change the name first time, the nameU (the universal name) will be changed, too. When you change it a second or third time, the universal name will not be changed. Maybe that is the problem, because for example in my german localisation of Visio, I have to either use the universal name of a shape in the ShapeSheet or use the ihe ID-Name, like Sheet.123.

So even if you think you have the right name, I would test it out a bit.
Select a shape and start this VBA code:

Sub Namentest()

Dim shp As Visio.Shape
Set shp = ActiveWindow.Selection.Item(1)
MsgBox "Name: " & shp.Name
MsgBox "NameU: " & shp.NameU
MsgBox "NameID: " & shp.NameID
MsgBox "ID: " & shp.ID

End Sub



----------
Are you saving your details-processes in the same drawing (only on different pages)? Then you have to look, that the start and esd process has another name everytim. If you don't Visio will give it another name with adding (.123) a number.

visio

Success!!!!

Ran the VBA against shape LFAQ3300_B and found that the Name and NameU were both set to LFAQ3300_B as expected. The NameID however was set to Sheet.105 and the ID 105. This id was also the same as seen in the format special of the shape.

Tried the mapping on the page shapesheet and used the NameID, Sheet.105, and as if by magic the reference worked!

Bit annoying that Name and NameU didn't reference to the page but will to other shapes, but good that now know how to do the page reference bit, use the NameID of the shape.

Thanks Jumpy, now on with completing the diagram and posting a demo.

visio

Sorry been away for a while, finally got this done, just about to post an example but cant get (remember) data source to link to field in thepage.

Have excel source with 2 Columns. Name of the Excel sheet is Batch_date. Name of the Columns are Start and Date. Value for Start is StartDate and Value for Date is Date.

On the sheet have a user defined field called Prop.StartDate. Label is "Date" Type=5. Value should be equal to the current date for example DATETIME(400407) which is 17/08/2010.

Basically what I did was copy the sheet from my completed master and paste onto a new Visio diagram in order to create a cut down version of the solution to post here. When this happened the link to the page disappeared and don't know how to get back. All that is being offered is link to shapes rather than link to page...

If this bit gets sorted then can post solution. Alternative is copy big master and remove extra info until a simple solutionl Think 100 Sessions with around 1000 sub-processes in linked pages bit much.

Jumpy

Hi visio,

congratulations. I think that was a big piece of work, especially the "detail" version.
Nice to know that it works.

Jumpy

visio

Here is the final solution (cut down version). This has 3 sessions each with sub processes. The run times are supplied in the attached spreadsheet. The times can be manipulated to change the diagram. In this case the connectors are shown (view menu) as this gives visibility to the position of processes which are not run. To make these truely invisible turn connector points off.

If the visio diagram is saved as a webpage then the hyperlinks will show the detail of the Sessions diagram. Pressing Ctrl when clicking on the mouse will show some information on the processes such as runtime and failures.

(if anyone can spot how I managed to link thepage to the batchdate external data then let me know as still can't figure out how I did this - look at linked shapes on the batch_date in the external data window and you will see thepage is linked. This is important as the date is used as an anchor point for the drawing of the Sessions diagram)

visio

#40
One final note on this. Noticed that a few times if data is refreshed (from excel) certain shapes do not update their data instead taking default values from the original master. Other shapes on the same page which are clones of this master do update their info.

It looks like if one day there is no runtime data as a report is notrun visio puts in default data from the master. The next time an update happens and there is data the master data will not overwrite so the shape does not draw correctly.

The problem with this is that when saved as a webpage the position of the process is so far up the page (using old data) that the page does not look right.

To fix this all that is required is to unlink the shape and relink the shape to the data and everything goes back to normal. Bit of a pain as in order to fix completely would mean unlinking all the shapes and then relinking each time data is refreshed. Thats 1000 shapes spread over 100 pages...

Is this a bug in Visio?

visio

#41
Think got a workaround for this.

Problem was if a process did not run then no start or end times. This was passed to Visio by excel and it looks like visio just took the default values set in the master sheet. It also looks like that as no data had been passed to Visio the link was incomplete. Next time when the same process ran and had a start and end time Visio did not update as the link to that data had not been established. Unlinking and relinking established the link which is a bit fiddly.

Workaround was to supply dummy data. As there is a not_run field, which will set the position of the shape if it didn't run, it doesn't matter what the data is as the shapes not_run parameter will override any dodgy positioning. By passing dummy data the link to Visio is maintained as Visio is always getting something even if it meaninless.  Next time an update is run as in the situation above the link is maintained and visio draws things as expected.

Bit of a flaff but seems to working for now, will update in a few days if everything remains stable.

Jumpy

I remembered to have thought about that problem somewhen. Some posts back in this thread I found it. Maybe the solution helps you.
The DataGrafic window is mentioned. It can be used, even if your linked shapes don't display DataGrafics.

Quote from: Jumpy on June 22, 2010, 07:54:14 PM
Edit: Tried it out, worked. But when you update and have no Data for montly/weekly shapes, the link to those shape breaks. You get an error message in the DataGrafic Window, but you can choose to ignore this. Later, when you update again when you have Data for those shapes, the link is still broken and the shapes are not updated. But you can choose to link shapes automatic to the ExternalData and you got all links back with one mouse click. But it must be possible to identify the right Data for each shape, that means your Data (=processes) must have sth. like a unique key, for example a process name or number (when its unique).


visio

Relinking is fairly simple but wanting to make this an automated process. The dummy data is working well. Dummy data would only be passed to shapes linked to processes that did not run and have not_run set to 1. The not_run parameter sorts the placement problem and all links are maintained.

Also as the dummy data is put in at source (code added to the extract data script) so the Visio diagram is uneffected.

Drawing the bacth process now takes a couple of mins but that is mostly dur to manually moving the data around. Once fully automated should take less than a minute with the Visio update of the diagram itself taking seconds.

visio

One final question (for extra credit)

Want to automate the update process and the save as webpage. Got the update part done and teh save as webpage but would like to have a timestamp added to the webpage name. The obvious date is actually from the linked data, the date of the batch run.

It is possible to refer to the linked data as part of a vba macro to save the visio disgram as a webpage? Currently just got it saving as the time from the PC but the batch run date more useful. (This could also be extracted from the property of a shape if this is could be referenced)

Application.Addons("SaveAsWeb").Run "/quiet=True /target=c:\Batch_diagrams\batch_diagram_" & Format(Now(), "ddmmyy") & ".htm"

would be better as below but how?

Application.Addons("SaveAsWeb").Run "/quiet=True /target=c:\Batch_diagrams\batch_diagram_"  & <date from Visio linked data - sheet, batch_date column Date Row 1 > & ".htm"