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

Using NULL values in expressions

21 REPLIES 21
Reply
Message 1 of 22
cbaildon001
2112 Views, 21 Replies

Using NULL values in expressions

Hi there

 

When I import survey data, sometimes my manholes have depth information and sometimes they don't.

 

I have a label style for manholes that show the lid level, the depth to invert and the invert level. This works well for manholes with depth information.

I have tried to create an expression that changes the text height of the depth and invert level to zero if the depth is zero or null.

 

IF(Point.Depth=0,0,0.0025) works for depths of zero but not null

IF(Point.Depth>0.001,0.0025,0) works for depths of zero but not null

IF(Point.Depth>0,0.0025,0) works for depths of zero but not null

 

How can I get an expression to work on a null value?

 

Cheers

 

Caleb Baildon
Senior Surveyor
Opus International Consultants Ltd
Wellington, New Zealand
Civil3D 2015 - Windows10
21 REPLIES 21
Message 2 of 22
odoshi
in reply to: cbaildon001

I don't have a dataset to test with, but did you try using ! ?

 

IF(!Point.Depth,0.0025)

 

I didn't see any built-in functions for Null and I am not sure what (if any) scripting language they are using.

 

Just a stab at it...

 

 

Mike

 

 

Mike Caruso
Autodesk Certified Instructor 2014
AutoCAD/Civil 3D Autodesk Certified Professional 2014, 2015, 2018
www.whitemountaincad.com
Message 3 of 22
jmayo-EE
in reply to: cbaildon001

IF(Point.Depth=' ',0,0.0025)

IF(Point.Depth=" ",0,0.0025)

IF(Point.Depth= ,0,0.0025)

 

 

A few more to try.

John Mayo

EESignature

Message 4 of 22
tcorey
in reply to: jmayo-EE

John, are you saying those worked or didn't work?



Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Gold Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
Message 5 of 22
jmayo-EE
in reply to: tcorey

I did not test anything. Just came up with a few ways for the OP to test that might check for the null value...

John Mayo

EESignature

Message 6 of 22
cbaildon001
in reply to: odoshi

IF(!Point.Depth,0.0025) - this produces an error when saving the expression "wrong number of arguments"

Caleb Baildon
Senior Surveyor
Opus International Consultants Ltd
Wellington, New Zealand
Civil3D 2015 - Windows10
Message 7 of 22
cbaildon001
in reply to: jmayo-EE

IF(Point.Depth=' ',0,0.0025) when saving the expression this produces an error 'parse error, undefined symbol ''

IF(Point.Depth=" ",0,0.0025) when saving the expression this produces an error 'parse error, undefined symbol "'

IF(Point.Depth= ,0,0.0025 )when saving the expression this produces an error 'parse error, unexpected ,, expecting name, function, number, (, +, -, or !'

Caleb Baildon
Senior Surveyor
Opus International Consultants Ltd
Wellington, New Zealand
Civil3D 2015 - Windows10
Message 8 of 22

make depth and invert seperate components

 

 

If(depth = 0 ,-1, <text height>)

if (depth =0,1,<text height>)

 

and hide negative values in the composer

Message 9 of 22
odoshi
in reply to: cbaildon001

Sorry, I left out a param.

 

IF(!Point.Depth,0,0.0025)

 

It will compile but I don't have any dataset to test it with.

 

Regards,

Mike

 

Mike Caruso
Autodesk Certified Instructor 2014
AutoCAD/Civil 3D Autodesk Certified Professional 2014, 2015, 2018
www.whitemountaincad.com
Message 10 of 22
cbaildon001
in reply to: odoshi

IF(!Point.Depth,0,0.0025) - Like other options I've tried it only works when the depth is 0 not NULL.

 

This issue has been ecsallated to Autodesk Support so hopefully they can come up with something, maybe 2016?

 

Thanks for your input.

Caleb Baildon
Senior Surveyor
Opus International Consultants Ltd
Wellington, New Zealand
Civil3D 2015 - Windows10
Message 11 of 22

Hi HorizonalCurveGuy

 

I'm not sure how these are supposed to work

If(depth = 0 ,-1, <text height>)

if (depth =0,1,<text height>)

as my depth does not equal 0, it is NULL or no value.

 

Cheers

Caleb Baildon
Senior Surveyor
Opus International Consultants Ltd
Wellington, New Zealand
Civil3D 2015 - Windows10
Message 12 of 22
loretom
in reply to: cbaildon001

Caleb,

 

Did you ever get a response or resolution from Autodesk Support?  I too need a function that will equal null.

 

Thanks,

 

Miguel

Message 13 of 22
cbaildon001
in reply to: loretom

Unfortunatly no solution as yet. But please post here if you find one.

 

Cheers

Caleb Baildon
Senior Surveyor
Opus International Consultants Ltd
Wellington, New Zealand
Civil3D 2015 - Windows10
Message 14 of 22
Joe-Bouza
in reply to: cbaildon001

When you say Null value is that the structure type?

Your Name
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

Your Name

EESignature

Message 15 of 22
cbaildon001
in reply to: Joe-Bouza

NULL is for a measurement of the depth to the invert. So for example when I survey the location of a manhole lid, but I do not record the depth to invert as well.

Caleb Baildon
Senior Surveyor
Opus International Consultants Ltd
Wellington, New Zealand
Civil3D 2015 - Windows10
Message 16 of 22
Joe-Bouza
in reply to: cbaildon001

If the invert is Null isn't it 0 at the same time ?
You can nest your expression by looking and another parameter, for example have a structure specific to no depth info, then you can check for structure type

Your Name
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

Your Name

EESignature

Message 17 of 22
loretom
in reply to: Joe-Bouza

I think I might have posted in the wrong location.

 

What I am looking for is a way for the expression to return nothing.  Like in lisp you can set a variable to nil.  I am not looking for null.  I should have paid more attention.

 

All I wanted to do is setup an expression for labeling an alignment that would know when it is the end of the alignment and not place a station there.  I can get it to identify the end of the alignment, but all I can do is set it to 0.  This displays 0+00.  I know I can just delete that last station after it's put in, but I want the label style to do it automaticly.

 

Thanks,

 

Miguel

Message 18 of 22
cbaildon001
in reply to: loretom

Hi loretom

 

When I say null, I mean nothing at all, and empty data cell. So our queries may well be related. Civil3D does not appear to be able to recognise empty data fields in expressions.

 

Joe - Just to clarify, I'm not using 'structures' in Civil3D, just cogo points. I guess a invert of 0 could be interpreted as null or no value. But I don't want to have to enter 0 for every manhole I survey if I am not concerned with invert levels, I just want to be able to leave the field blank and be able

get an expression to recognise this.

 

Cheers

 

Caleb Baildon
Senior Surveyor
Opus International Consultants Ltd
Wellington, New Zealand
Civil3D 2015 - Windows10
Message 19 of 22
Joe-Bouza
in reply to: cbaildon001

No structures! that's a different ball of wax. The whole time I was thinking manholes and catch basins expressions. Oh well cancel all that. :0

Your Name
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

Your Name

EESignature

Message 20 of 22
C3D_TomR
in reply to: Joe-Bouza

Another instance of needing to check for NULL (not 0) values in an expression is if a surface spot elevation is outside of the surface the elevation value is NULL (not 0). If an expression could test for NULL values then the text height could be set to something not visible when it's outside of the surface extents instead of showing ??? as the elevation value.

 

Tom Richardson
CAD Manager
Crossing the line with Civil 3D
Twitter | LinkedIn


If you find an answer to your question, please mark Accept as Solution so others can find it...

Tom Richardson


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature
Autodesk Certified Professional in Civil 3D for Infrastructure Design
AutoCAD Certified Professional
------------------------------------
Autodesk AEC Community Blog
Crossing the line with Civil 3D
Twitter | LinkedIn
------------------------------------
Austin CAD User Group Resources
Blog | Discord | LinkedIn

Autodesk Group Network Leader

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

Post to forums  

Rail Community


 

Autodesk Design & Make Report