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

Caculated Attribute

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
Ray_K
242 Views, 9 Replies

Caculated Attribute

I am trying to create an custom attribute to extract last 2 characters from an existing attribute. I can't use Substring or Trim function due to the number of character of the existing attribute is not the same all the time.

 

Is there any other possible work around to achieve this?

 

Example.

XXX-YY-ZZ  -->  ZZ

XXXX-YYY-ZZ --> ZZ

9 REPLIES 9
Message 2 of 10
h_eger
in reply to: Ray_K

Dear @Ray_K ,

 

simple answer: no
Your task cannot be solved with the means provided by Autodesk.

-

If my reply was helpful, please give a "Kudo" or click the "Accept as Solution" button below (or both).

Hartmut Eger
Senior Engineer
Anlagenplanung + Elektotechnik
XING | LinkedIn

EESignature



Message 3 of 10
DVaquand
in reply to: Ray_K

Bonjour

 

Si vous êtes en version Plant 3D 2024 vous disposez d'une nouvelle fonction calculée "SPLIT"
Elle permet d'extraire des informations à une position donnée à partir d'un séparateur

Par exemple pour récupérer la propriété qui contient cette information :XXX-AA-ZZ --> ZZ
SPLIT(PropertyName,'-',3)

 

DVaquand_0-1708251852605.png

 

Notez que si vous ouvrez le projet avec une version antérieure à Plant 2024, cette propriété calculée ne fonctionnera pas.

 

== Français ==

 

Si vous êtes en version Plant 3D 2024 vous avez une nouvelle fonction calculée "SPLIT"
Elle permet d'extraire des informations à une position donnée depuis un séparateur

 

Par exemple pour récupérer la propriété qui contient cette information : XXX-AA-ZZ --> ZZ
SPLIT(NomDeLaPropriété,'-',3)

 

Notez que si vous ouvrez le projet avec une version antérieure à Plant 2024, cette propriété calculée ne fonctionnera pas.

 

Cordialement
Dominique VAQUAND
www.dovaq.fr


Si mon message propose une solution, veuillez cliquer sur "Accepter comme solution"
If my post offers a solution, please click "Accept as Solution"

 

Cette publication vous a-t-elle été utile ? N’hésitez pas à attribuer la mention J’aime à cette publication.
Avez-vous obtenu la réponse à votre question ? Cliquez ensuite sur le bouton ACCEPTER LA SOLUTION.

EESignature

Message 4 of 10
h_eger
in reply to: Ray_K

Dear @DVaquand ,

 

How does Split behave if the separator '-' is contained in the value more than once?

-

If my reply was helpful, please give a "Kudo" or click the "Accept as Solution" button below (or both).

Hartmut Eger
Senior Engineer
Anlagenplanung + Elektotechnik
XING | LinkedIn

EESignature



Message 5 of 10
DVaquand
in reply to: h_eger

hello @h_eger 

 

This is the position of the information after the separator.
I made a mistake which I am correcting

 

To retrieve the "ZZ" value from "XXX-AA-ZZ"
SPLIT(PropertyName,'-',3)

 

== French ==

 

C'est la position de l'information après le séparateur.
J'ai fait une erreur que je corrige

 

Pour récupérer la valeur "ZZ" de "XXX-AA-ZZ"
SPLIT(PropertyName,'-',3)

 

Cordialement
Dominique VAQUAND
www.dovaq.fr


Si mon message propose une solution, veuillez cliquer sur "Accepter comme solution"
If my post offers a solution, please click "Accept as Solution"

Cette publication vous a-t-elle été utile ? N’hésitez pas à attribuer la mention J’aime à cette publication.
Avez-vous obtenu la réponse à votre question ? Cliquez ensuite sur le bouton ACCEPTER LA SOLUTION.

EESignature

Message 6 of 10
h_eger
in reply to: DVaquand

Dear @DVaquand ,

 

Yes, but the specifications were defined differently.

Example:
XXX-YY-ZZ --> ZZ
XXXX-YYY-ZZ --> ZZ

-

If my reply was helpful, please give a "Kudo" or click the "Accept as Solution" button below (or both).

Hartmut Eger
Senior Engineer
Anlagenplanung + Elektotechnik
XING | LinkedIn

EESignature



Message 7 of 10
DVaquand
in reply to: h_eger

Hello @h_eger 

 

XXX YY ZZ --> ZZ
XXXX YYY ZZ --> ZZ

 

In this case, TRIM will remove the spaces before and after.
TRIM(SPLIT(PropertyName,'-',3))

 

== French ==

 

Dans ce cas là, TRIM supprimera les espaces avant et après.
TRIM(SPLIT(PropertyName,'-',3))

 

Cordialement
Dominique VAQUAND
www.dovaq.fr


Si mon message propose une solution, veuillez cliquer sur "Accepter comme solution"
If my post offers a solution, please click "Accept as Solution"

Cette publication vous a-t-elle été utile ? N’hésitez pas à attribuer la mention J’aime à cette publication.
Avez-vous obtenu la réponse à votre question ? Cliquez ensuite sur le bouton ACCEPTER LA SOLUTION.

EESignature

Message 8 of 10
Ray_K
in reply to: DVaquand

@DVaquand

 

I tried but not working, not sure if I do it right.

 

Property name : Tag (example  Line Number tag: A51-U10-P908-SHT01)

 

A51-U10-P908-SHT01

trim(split(Tag,'-SHT',3))  --> desired outcome "01"

 

A51-U10-P908-SHT01

how about if I want to get A51-U10-P908 only get rid of the last 6 characters

Message 9 of 10
DVaquand
in reply to: Ray_K

Hello

 

The value returned by SPLIT is the position of the string relative to the delimiter
For example "A51-U10-P908 -SHT 01"


If the delimiter is "-" and if SPLIT(Tag,'-',1) this will return the value "A51"

 

If the delimiter is "-SHT" and if SPLIT(Tag,'-SHT',2) this will return the value "01"

 

To remove spaces (by default) you can use the TRIM function
TRIM(SPLIT(Tag,'-SHT',2)) will return the value "01"

 

To retrieve the value before the delimiter, either "A51-U10-P908"
TRIM(SPLIT(Tag,'-SHT',1)) will return "A51-U10-P908"

 

Notes
You must be on an AutoCAD Plant 2024 version.
The SPLIT function does not work on earlier versions

 

== French ==

 

La valeur retournée par SPLIT est la position de la chaine par rapport au délimiteur
Par exemple A51-U10-P908 -SHT 01


Si le délimiteur est "-" et si SPLIT(Tag,'-',1) cela retournera la valeur "A51"

 

Si le délimiteur est "-SHT" et si SPLIT(Tag,'-SHT',2) cela retournera la valeur " 01"

 

Pour supprimer les espaces (par défaut) on peut utiliser la fonction TRIM
TRIM(SPLIT(Tag,'-SHT',2)) retournera la valeur "01"

 

Pour récupérer la valeur avant le délimiteur, soit "A51-U10-P908"
TRIM(SPLIT(Tag,'-SHT',1)) retournera la "A51-U10-P908"

 

Notes
Vous devez être sur une version AutoCAD Plant 2024.
La fonction SPLIT ne fonctionne pas sur des versons antérieures

 

Cordialement
Dominique VAQUAND
www.dovaq.fr


Si mon message propose une solution, veuillez cliquer sur "Accepter comme solution"
If my post offers a solution, please click "Accept as Solution"

Cette publication vous a-t-elle été utile ? N’hésitez pas à attribuer la mention J’aime à cette publication.
Avez-vous obtenu la réponse à votre question ? Cliquez ensuite sur le bouton ACCEPTER LA SOLUTION.

EESignature

Message 10 of 10
Ray_K
in reply to: Ray_K

@DVaquand 

 

Thank you. Its is working now. The previous value "3" that you provided was not the right one. "1 & 2" is the correct. 

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

Post to forums  

Autodesk Design & Make Report

”Boost