cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PLANTDEFINECALCPROPERTIES SubString backwards search

PLANTDEFINECALCPROPERTIES SubString backwards search

I need a new function that has the ability to look from the last character of a string and return a group of characters.

Currently the substring function is available to look for parts of a field value but if the field value character length is inconsistent than the returned value cannot be controlled.

 

Example:

Tag number 4"-BD-A1-1234_SHT01

Substring (TAG, 17, 2) will return '01'

 

But if the tag is 10"-FWS-A21-1234_SHT01

Substring (TAG, 17, 2) will return 'SH'

 

 

In SQL a LEFT or RIGHT function can be used to find characters either at the Start of End of a string.

Tag number 4"-BD-A1-1234_SHT01

Select RIGHT (TAG, 2) will return 01

 

3 Comments
jhamilton
Advocate

Is this for P&ID or Plant 3d?  What are the specific fields that make up this tag.  (I don't want to assume)

Anonymous
Not applicable

This is for Plant 3D 2017.

 

I'm pulling the 'SpoolNumber' field from 'Pipe Run Component' into the 'P3D Line Group' 'Tag Format'.   This gives me the ability to run isometrics by spool number instead of by the entire line number.

 

Being able to mine the 'Tag Format' of this 'SpoolNumber' value gives me the ability to create a field I can use to Layer the piping objects as I would like to.

jhamilton
Advocate

It would be really nice if they would add more to plantdefcalculations.  Then you could use charindex like you can in the report creator to count the characters in order to locate a string.

 

I am not sure how all your fields are setup for the tags.  It appears you have one field that contains 1234_SHT01 that makes up the last part of your tag.  You could use your substring function to pull from that as is seem consistent rather than try to pull from the whole tag.  You could also break up the 1234_SHT01 into two separate fields or even 3 fields and put it back together with plantdefcalculations.  This would give you clearly defined O1 to that you are looking for.

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

Submit Idea