FILENAME() Shapesheet function does not update

Started by huever, October 15, 2019, 06:42:09 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Surrogate

#15
Quote from: wapperdude on October 17, 2019, 05:19:29 AMAlternative work-around...
Another one:
in some user-defined cell place formula with condition which must update FILENAME value
IF(0=0,SETF(GetRef(User.Row_3),FILENAME()),SETF(GetRef(User.Row_3),FILENAME()))

Croc

Surrogate, are you sure?
This formula does not work for me.

Surrogate

#17
Not, sure. It is just suggest. I use Visio 2003 and haven't problems with update value in this field.   8)
Because i can't use vsdx-files!

UPDATE: i check my formula again, really it dont work. New modification  - wrap FILENAME() in commas.
IF(0=0,SETF(GetRef(User.Row_3),"FILENAME()"),SETF(GetRef(User.Row_3),"FILENAME()"))

vojo

I guess I am obtuse, since I don't think this formula should actually work

Essentially, you are saying if(true, do this, do that)....but should never get to the do that since 0=0 is  ALWAYS true
(if you really don't care about else branch, you can have only a ...,) ending ...don't need an explicit else clause)
(BTW, might want to use if (true,...,...) or if(1,....,...) or if(1=1,...,...)vs if(0=0,...,...) ...it would be more obvious to reader)
More over, the only way this fires is if there is a change in filename()...but if filename changes are not caught in the first place, why would this fire?  VISIO will NOT just arbitrarily walk blindly thru every cell...it only evaluates a cell  if there is some change to the cells inputs...here filename (imagine walking thru 20 shapesheets * 100 cells in order to find the 1 cell with a change).

Sort of why I suggested DEPENDSON to make sure this cell is periodically reevaluated.  Basically, if I understand the requirements, you will need some trigger to force cell evaluation.  Don't like DEPENDSON, fair enough, you can set up a trigger a different way (2 user cells for old and new ===> new becomes old if a change, actions, could use the time() function since it always changes , could even see if there is a DOCMD command that could be used as a trigger some cell change)

maybe something like user.filename = filename() + now()   This would force the cell to be reevalutated every second because now() is always changing

Good luck

huever

Quote from: Croc on October 16, 2019, 06:25:20 PM
You can try the option without a program.
In one cell we make the minute timer, but we distinguish only even and odd values.
With an even value, we write a function, with an odd value, its value.
Very cumbersome, but it works :)

Scratch.A1=IF(Scratch.C1=0,SETF("Fields.Value","FileName()"),SETF("Fields.Value",GetVal(Fields.Value)))+DEPENDSON(Scratch.B1)
Scratch.B1=NOW()
Scratch.C1=1
Scratch.D1==IF(GetVal(Scratch.C1)>0,SETF(GetRef(Scratch.C1),"0"),SETF(GetRef(Scratch.C1),"1"))+DEPENDSON(Scratch.B1)


Wow, I wouldn't invent it myself, but this solution actually WORKS. I open the drawing and the name is updated. Seems a bit crazy, but successful!

Thanks a lot for your answers, now I know how to workaround the problem  :)

Croc

vojo suggested a simpler solution
Check it out too

huever

Yes, that way it works too. I did something like this:

User.Row_1.Value = FILENAME()

User.Row_2.Value = =IF(FILENAME()=User.Row_1,FILENAME(),FILENAME())

Then I display User.Row_2 -> works also perfectly ;)

Thanks, again for your quick help!  ;)