I am trying to make a schedule that has a formula and I have no clue how to use VB Script.
I've got three columns that have values in them. If one column has a number than the other 2 are blank. I want to make a formula column that will return a text string depending on which column has a value not equal to 0. I've looked up VBscripts in an attempt to create an if then statement but I don't get the sample text to work.
Also I realize that an If Then statement doesn't really do the job since I want it to evaluate 3 conditions.
I've attached a dumb sample of what I am trying to do. Any help would be appreciated.
Thanks,
Tom
Solved! Go to Solution.
Solved by David_W_Koch. Go to Solution.
The Block version of the If Then ElseIf Else statement can be used to have multiple tests. If you are saying that of the three test properties, only one will have a non-zero value, and the other two will always have a zero value, then the attached file should do what you want (other than having to replace the RESULT strings with the value you want to see in your schedule. I would probably do this with a Formula Property, rather than a Formula column, but either will work, as can be seen in the attached file, where I both edited the formula in your Schedule Table column as well as added a similar formula to a formula property and added that as a column in your schedule.
More than you ever wanted to know about If Then Else Statements:
http://architects-desktop.blogspot.com/2005/07/structureflow-in-formula-properties.html
Thanks David-
Unfortunately I did not see your first response, only the second one with the reference to the Architects Desktop Blog. With the information on that blog I was able to figure out how to use the IfThenElse Block and got the thing to work. It may not be elegant but it works for me! Here it is for your entertainment.
If Left( "[Gaming Fixtures:Name]", 3 ) ="PIT" Then RESULT = "T"
ElseIf Left( "[Gaming Fixtures:Name]", 4 )="AREA" Then RESULT = "S"
ElseIf InStr( "[Gaming Fixtures:Name]", "SLOT" )<>0 Then RESULT = "S"
ElseIf Left( "[Gaming Fixtures:Name]", 4 )="CIRC" Then RESULT = "C"
ElseIf InStr( "[Gaming Fixtures:Name]", "PATH" )<>0 Then RESULT = "C"
Else
RESULT = "O"
End If