Shared Parameter in formula, has - in name

Shared Parameter in formula, has - in name

dtiemeyer
Advisor Advisor
378 Views
12 Replies
Message 1 of 13

Shared Parameter in formula, has - in name

dtiemeyer
Advisor
Advisor

I have a shared parameter with a hyphen in the name. When I try to make a formula to strip the units out of it and have that become a number, the hypen in the name gets interpreted as a 'minus operation' and the formula fails. I tried putting quotes around the shared parameter name, but that did not fix the issue.  Is there any way to mitigate the hypen in the name of the Shared Parameter so it doesnt get treated like a minus within the context of a formula?

My other CAD is a Cadillac and I like to Revit to the Max!
0 Likes
Accepted solutions (1)
379 Views
12 Replies
Replies (12)
Message 2 of 13

RLY_15
Advisor
Advisor

Unfortunately, this is the explicit use case why it's recommended that Shared Parameters do not use operators in naming convention (use underscore instead if you need to use special characters).

 

I'd love to push this to Revit Ideas (disallow operators in Shared Parameter permitted characters), except the implementation would break legacy shared parameter files and force a jump-off point in files (like when Type Catalogs got modified for forge data types)

Message 3 of 13

dtiemeyer
Advisor
Advisor

Thanks. That's what I thought, but I was hopeful there was a workaround. Unfortunately I cannot find anywhere that Autodesk has published this 'recommendation', wish I would've been aware of it 15 years ago when creating my families/parameters/etc.

My other CAD is a Cadillac and I like to Revit to the Max!
0 Likes
Message 4 of 13

GaryOrrMBI
Collaborator
Collaborator
Accepted solution

Enclose the parameter with the minus sign in square brackets [Something - Else]

GaryOrrMBI_0-1755009980204.png

-Gary

 

Gary J. Orr
GaryOrrMBI (MBI Companies 2014-Current)
aka (past user names):
Gary_J_Orr (GOMO Stuff 2008-2014);
OrrG (Forum Studio 2005-2008);
Gary J. Orr (LHB Inc 2002-2005);
Orr, Gary J. (Gossen Livingston 1997-2002)
Message 5 of 13

dtiemeyer
Advisor
Advisor

@GaryOrrMBI 

Thank you VERY much. You just saved me many hours. Cheers sir.

My other CAD is a Cadillac and I like to Revit to the Max!
Message 6 of 13

RDAOU
Mentor
Mentor

bump...

 

window has been open for a very long time while the question was already answered

 

 

YOUTUBE | BIM | COMPUTATIONAL DESIGN | PARAMETRIC DESIGN | GENERATIVE DESIGN | VISUAL PROGRAMMING
If you find this reply helpful kindly hit the LIKE BUTTON and if applicable please ACCEPT AS SOLUTION


0 Likes
Message 7 of 13

mari.shimode
Community Manager
Community Manager

Hi @dtiemeyer, it seems you found @GaryOrrMBI's reply useful. Although it's a workaround, I have marked it as an accepted solution so others who have the same question can also benefit from it. Please visit us again whenever you have any other questions. 



Mari Shimode
Community Manager
0 Likes
Message 8 of 13

Mike.FORM
Advisor
Advisor

@mari.shimode using the [] brackets is not a workaround, it is specifically what they meant to do, they indicate that everything within them should be treated as one parameter name.

It is why certain characters cannot be used in parameter names as they have specific functions as a standard within operating systems and within Revit the [] brackets have been set to perform this function in parameter formulas.

MikeFORM_0-1755097489183.png

 

Message 9 of 13

Mike.FORM
Advisor
Advisor

Also, if you have a parameter named "something" and it is being used in a formula and you decide to change the parameter name to be "something - else" the formula will be updated to include the [] brackets around that parameter name so the formula doesn't break.

Message 10 of 13

mari.shimode
Community Manager
Community Manager

Hi @Mike.FORM, thank you for the correction and apologies for my misunderstanding.



Mari Shimode
Community Manager
Message 11 of 13

GaryOrrMBI
Collaborator
Collaborator

@Mike.FORM wrote:

Also, if you have a parameter named "something" and it is being used in a formula and you decide to change the parameter name to be "something - else" the formula will be updated to include the [] brackets around that parameter name so the formula doesn't break.


This is actually how most people (myself included) learn about the square bracket usage... accidentally. It is not covered in the help under formulas as it should be. @mari.shimode Perhaps, if that omission was corrected, there would be less need for these questions to be asked 🙂

 

GaryOrrMBI_0-1755177192145.png

 

-G

 

Gary J. Orr
GaryOrrMBI (MBI Companies 2014-Current)
aka (past user names):
Gary_J_Orr (GOMO Stuff 2008-2014);
OrrG (Forum Studio 2005-2008);
Gary J. Orr (LHB Inc 2002-2005);
Orr, Gary J. (Gossen Livingston 1997-2002)
Message 12 of 13

mari.shimode
Community Manager
Community Manager

Hi @GaryOrrMBI, thank you for the feedback! I'll share it with a relevant team.



Mari Shimode
Community Manager
0 Likes
Message 13 of 13

harrimanevan
Participant
Participant

Just came to this thread to figure out why an rfa I downloaded from a vendor had the parameter name in brackets in a formula : )

0 Likes