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
Solved! Go to Solution.
Solved by DVaquand. Go to Solution.
Solved by DVaquand. Go to Solution.
Dear @Ray_K ,
simple answer: no
Your task cannot be solved with the means provided by Autodesk.
Hartmut Eger
Senior Engineer
Anlagenplanung + Elektotechnik
XING | LinkedIn
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)
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.
Dear @DVaquand ,
How does Split behave if the separator '-' is contained in the value more than once?
Hartmut Eger
Senior Engineer
Anlagenplanung + Elektotechnik
XING | LinkedIn
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.
Dear @DVaquand ,
Yes, but the specifications were defined differently.
Example:
XXX-YY-ZZ --> ZZ
XXXX-YYY-ZZ --> ZZ
Hartmut Eger
Senior Engineer
Anlagenplanung + Elektotechnik
XING | LinkedIn
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.
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
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.