AutoCAD Architecture Forum
Welcome to Autodesk’s AutoCAD Architecture Forums. Share your knowledge, ask questions, and explore popular AutoCAD Architecture topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using VB Script in Schedule Formulas

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
FitzUS
1282 Views, 4 Replies

Using VB Script in Schedule Formulas

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

4 REPLIES 4
Message 2 of 5
David_W_Koch
in reply to: FitzUS

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.


David Koch
AutoCAD Architecture and Revit User
Blog | LinkedIn
EESignature

Message 3 of 5
David_W_Koch
in reply to: FitzUS

More than you ever wanted to know about If Then Else Statements:

http://architects-desktop.blogspot.com/2005/07/structureflow-in-formula-properties.html


David Koch
AutoCAD Architecture and Revit User
Blog | LinkedIn
EESignature

Message 4 of 5
FitzUS
in reply to: David_W_Koch

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

 

 

 

Message 5 of 5
David_W_Koch
in reply to: FitzUS

Looks elegant to me.  Glad I could point you in the right direction.


David Koch
AutoCAD Architecture and Revit User
Blog | LinkedIn
EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost