Datafields from Subshapes (and vice versa)

Started by TwoBeAss, February 09, 2024, 07:07:05 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TwoBeAss

Hey Visioguys,
Another day, another challenge...
Its a bit hard to explain, but I hope its understandable what I want to achieve...

I have a group of shapes, where each shape holds a prop value (will be a master shape in the future). The group will be linked to an Excel workbook where the values could be stored.
I will use Nikolay's BackSync addin to be able to change the data in Visio and synchronise it back to the Excel sheet.

So this will be the scenario

- Add Mastershape to page
- Link to existing data row
- Values to be retrieved (as an array from a cell)
- Change values within Visio
- Values should be saved back to Excel using the BackSync addin

I hope this was understandable... One additional piece of information to make it even more complicated: It could be that one of the subshapes is deleted, this should also be taken into account :/.

Thanks for any ideas!
TwoBe

Yacine


Not really clear where your problem is.



       
  • Check in Visio for differences to the Excel data - and add or delete shapes
  • Overwrite all data from Excel into Visio
  • Do then the actual editing in Visio
  • Check in Excel for additions and deletions and make the necessary modifications
  • Write the data back to Excel
It would of course be better to have only one source of truth to avoid having to compare the data.
To do so you could try storing the missing information in one document and build up the other one dynamically.
I would need more information on the data structure and your whole scenario to say something usefull.
Yacine

TwoBeAss

#2
The Problem is, once i delete a shape, the Formula in the GroupShape gets a value, or if i GUARD the Formula, the deleted shapes references are put in as REF()...
I tried to help me now, with a

groupShape.CellsU("Prop.Value").FormulaForceU = "=" & Replace(groupShape.CellsU("Prop.Value").FormulaU, subShape.Name & "!Prop.Name", """""")

in my deletion macro...

Not really elegant, but was my only idea i got so far...

EDIT:
I ran into another issue.. The BackSync works just fine, so i could store the data that is edited in Visio, but if i want to add a new item to the page, with data from the database, the values are of course not written back to the subshapes... I think I have a knot in my head here...

TwoBeAss

#3
I have extended my sample, hopefully this makes it a bit clearer. I dont know how to organise the shapestructure better, but it needs to be a group of shapes where the subshapes hold the values for the text...
Thanks for your help!

wapperdude

Visio 2019 Pro

Yacine

When I asked about the scenario, I meant information about
- why are there 2 documents? What do you do in each document? What is their purpose?


Then you say that you draw a shape but miss the information about the database. The way I solved this issue is that I called from the shape itself via a command field + callthis function a VBA form. The form would open the DB, fill a listbox and present it to the user. From there you could then copy the values of one row of the DB to the currently selected shape. I think you can call this a "reference" function. That is one of the simplest tasks.
Doing this with onboard tools is also easy. Under the data ribbon use the external data window, open in it your DB and once you dropped a master on the drawing, just link a row to that newly created shape.
Yacine

TwoBeAss

Sorry for this confusion.. I am now handling all the variables in the main element and get the right values for the childitems with INDEX from the root.. Working as expected, thanks for all your support!