[Ri...] Posted March 23, 2019 Share Posted March 23, 2019 I am trying to structure a file naming method utilizing the last 5 characters in a string. If the 5 character from the right is "0" (Zero) then "Path" is something. Else the Path is "some other path". I understand basic If, Else, Then structure, I'm just not up to speed on Calypso formatting. basic string: C:\My Folder\123456_A_20_A1_0.pdf Any help is appreciated Edit: I think I can test for "inspectionToleranceState() = 0" instead of reading a string. If inspectionToleranceState() = 0 then "Use this Path" Else "Use this other Path" Link to comment Share on other sites More sharing options...
[He...] Posted March 23, 2019 Share Posted March 23, 2019 Something like this? string = "my string is wider than yours" //Find the 5th character from the right. (might be the 4th or 6th as well. Play around with the bold number until you find the correct character.) char_5 = subStr(string,len(string)-5,len(string)-5) if char_5 == "0" path = "C:\Something\" else path = "C:\Something Else\" endif Link to comment Share on other sites More sharing options...
[Ri...] Posted March 25, 2019 Author Share Posted March 25, 2019 Thank you! I'm thinking more on this simpler method (?). How do I format this to work with PCM for a path to create a PDF file? Calypso menu: ...Resources ......Name for output files .........for this Measurement Plan ............PDF file PiWeb reporting if inspectionToleranceState() == "0" path = ""S:\CMM - Inspection Results & Zeiss Table Files_Vault\CMM-Inspection-PDF Files Accept\"+getRecordHead("order")+"\"+getRecordHead ("mfgdev")+"\"+getRecordHead("u_DBSWITCH")+"_"+getRecordHead("partnbinc")+"_PiWeb.pdf"" else path = ""S:\CMM - Inspection Results & Zeiss Table Files_Vault\CMM-Inspection-PDF Files Reject\"+getRecordHead("order")+"\"+getRecordHead ("mfgdev")+"\"+getRecordHead("u_DBSWITCH")+"_"+getRecordHead("partnbinc")+"_PiWeb.pdf"" endif Link to comment Share on other sites More sharing options...
[Wa...] Posted March 28, 2019 Share Posted March 28, 2019 Define the path variable in the presettings of the measurement plan path = "" The following is in the postsettings its = inspectionToleranceState() if its == "outOfTolerance" path = "C:\CMM - Inspection Results & Zeiss Table Files_Vault\CMM-Inspection-PDF Files Reject\" else path = "C:\CMM - Inspection Results & Zeiss Table Files_Vault\CMM-Inspection-PDF Files Accept\" endif The following is the path for the "Name definitions for output files for this Measurement Plan" path + getRecordHead("order")+"\"+getRecordHead ("mfgdev")+"\"+getRecordHead("u_DBSWITCH")+"_"+getRecordHead("partnbinc")+"_PiWeb.pdf" Link to comment Share on other sites More sharing options...
[Ri...] Posted March 28, 2019 Author Share Posted March 28, 2019 Thank you for your assistance. Link to comment Share on other sites More sharing options...
[Cl...] Posted March 29, 2022 Share Posted March 29, 2022 Please sign in to view this quote. if inspectionToleranceState() == "0" I don't use PCM much, so does the "0" have to be defined somewhere? Where exactly do I insert the code? Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in