EVALTEXT ShapeSheet Function

Started by jebuxx, December 29, 2014, 04:31:32 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jebuxx

I am stuck on an IF(EVALTEXT  formula this will do this
I have a dropdown menu of 20 items - sheet 1
Sheet 2 I would like to EVAL the TEXT of sheet 1 and then display a row form the shape data where I have a data file linked.

I have tried this...
IF(EVALTEXT(Sheet.1!TheText)="SF-01", Prop.VisDM_4,IF(EVALTEXT(Sheet.1!TheText)="SF-02",Prop.VisDM_5,IF(EVALTEXT(Sheet.1!TheText)="SF-03",
Prop.Vis_6,)))))

can somene help with correcting this?

Yacine

#1
Hi Jebuxx,
in the shapesheet strings are compared via the function STRSAME, not String=String2 --> IF (STRSAME(String1,String2),TRUE,FALSE)
Yacine

jebuxx

#2
I do not quite understand. Would you mind creating a formula that would explain it better?
thanx

Visio Guy

Hi Jebuxx,

The EVALTEXT attempts to make numerical or ShapeSheet-syntax sense out of a string. Some examples:

"1 + 1" = 2
"1 + SIN(45 DEG)" = 1.7071

A normal blob of text evaluates to 0 in the ShapeSheet. So, e.g. "Bob" = 0. Therefore, "Bob" = "Steve".

If you want to check if strings are identical, you use the STRSAME function, and if you reference a shape's text, you need to wrap it in the SHAPETEXT function. (Because just Sheet.1!TheText will just evaluates to 0 in the ShapeSheet. SHAPETEXT tells the ShapeSheet that you want the actual text from the shape. Weird, I know.)

So, I think for your case, the test you want is something like:

  STRSAME( SHAPETEXT(Sheet.1!TheText), "SF-01" )

This will return True or False. The third argument (not shown above) for STRSAME is for case insensitivity. STRSAME is case-sensitive by default (i.e. if you omit the third argument.)

For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Visio Guy

For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

jebuxx

Hi Yacine, I tried what you mentioned and still get an error in the formula. I will try to be more clear.
Sheet one is a drop down I have created in the Shape data as a fixed list. There are 20 items to pick from.
Sheet 2 has the linked data file however I have not associated a field to it.
This data file has atrabutes of the 20 items that are not similar between them.
When a selection is made in sheet one via the drop down list, say SF-01 I need sheet 2 (and sheets 3.4.5.6 and so on)
to display a selected field from the linked data file.
Here is my stab at it. Please let me know where I making errors.

IF(STRSAME( SHAPETEXT(Sheet.1!TheText), "SF-01" ) Sheet.2!Prop._VisDM_Item_, IF(STRSAME(SHAPETEXT(Sheet1!TheText),"SF-02"), Sheet.2!Prop._VisDM_Panels_,))))))

My goal here is this....
I am creating an order entry form. I want the user to select an item from the drop down list thus populating the sheets I asign to the data base. I am working on a back door approach to making this happen due to the fact that only one data rown can be linked to a sheet (shape)
If this works I will pass along a sample to you. Thus form will also drive our templates in size and configuration and rules to manufacture. I have that part working but am stuck on this part. Your help is greatly apperciated!!!


Yacine

Thank you Chris for the nice explanation ;D
Yacine

jebuxx

I guess I am missing something here. Still not real sure how to write this.

wapperdude

@jebuxx: 
For your example you entered
  IF(STRSAME( SHAPETEXT(Sheet.1!TheText), "SF-01" ) Sheet.2!Prop._VisDM_Item_, IF(STRSAME(SHAPETEXT(Sheet1!TheText),"SF-02"), Sheet.2!Prop._VisDM_Panels_,))))))

It should be:
  IF(STRSAME( SHAPETEXT(Sheet.1!TheText), "SF-01" ) , Sheet.2!Prop._VisDM_Item_, IF(STRSAME(SHAPETEXT(Sheet1!TheText),"SF-02"), Sheet.2!Prop._VisDM_Panels_,""))

I think there needs only be two parens at the end, unless I miss counted.  Just remember, the total number of right parens must be same as total number of left parens.

Also, the very last eval option, the "", can actually be the default final eval case, without an explicit test.  For example, say you have three conditions: A, B, and C.  If your input equals one of these cases, you want to execute either Astuff, or Bstuff, or Cstuff.  And, assume, those are the only 3 possible entries...perhaps from a database or dropdown list, etc.  Your "IF" statements would look like this:

IF(input=A,Astuff, if(input=B, Bstuff, Cstuff)).  Cstuff automatically happens when neither A or B match the input...doesn't need a separate test.

HTH
Wapperdude

Visio 2019 Pro

jebuxx

Works GREAT!!!  thanx again for all you help.