Diesel Expression - File name IF Equations

Diesel Expression - File name IF Equations

Oli
Enthusiast Enthusiast
1,480 Views
5 Replies
Message 1 of 6

Diesel Expression - File name IF Equations

Oli
Enthusiast
Enthusiast

Hi All, 

 

Hoping you can help me, trying to write an expression to take part of a file name to inform an attribute, but I'm having a tad of trouble, and I'm not sure if its possible?!

 

What I'm trying to achieve is that "VAR" in the sample file name below can be a series of pre-defined letters that equal a drawing status, and when this is change its will update the attribute in the titleblock

 

                  Filename = ####-###-VAR

                 ASB  = AS BUILT

                 INF = INFOMATION

 

So I assumed I could do something like this:   $(if, ($(eq, val1, val2)), dotrue [, dofalse]) 

Where:

                 Val1 = ($(substr,$(getvar,dwgname),10,3))

                 Val2 = INF 

                 dotrue = Infomation

                dofalse = repeat simualr to excel IF equation. to include other variations

 

i have a feeling that   $(eq, val1, val2) has to be numerical?! - is there a version that works for text? that returns a 1 or 0 that would work wit with the IF equation?

Or is there a better way of doing this? 

 

Thanks in advance!

 

 

0 Likes
Accepted solutions (1)
1,481 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
0 Likes
Message 3 of 6

Oli
Enthusiast
Enthusiast

Hi,

 

thanks for your post - although I've already got that bit of code - what I'm trying to do is use an IF equation to convert a series of letter within the drwaing title to a full word, this would allow me to maintain file naming standard.

 

 

0 Likes
Message 4 of 6

Paul_Gander
Advocate
Advocate
Accepted solution

You are on the right track. Try this:

 

$(if,$(eq,$(upper,$(substr,$(getvar,dwgname),10,3)),INF),Information,$(if,$(eq,$(upper,$(substr,$(getvar,dwgname),10,3)),ASB),As built, ))

There is a limit to the number of variations you'll be able to add to this though.

0 Likes
Message 5 of 6

ronjonp
Mentor
Mentor

If I'm understanding correctly you need to nest like so:

$(if,$(eq, ($(substr,$(getvar,dwgname),10,3)), INF), Information, $(if,$(eq, ($(substr,$(getvar,dwgname),10,3)), ASB), AS BUILT, XXX))

*Edit TOO SLOW 🙂 

0 Likes
Message 6 of 6

Oli
Enthusiast
Enthusiast

Thanks Paul,

 

I'd done too many brackets in my attempt - nice to know i was on the right track!

0 Likes