hexagon logo

Cell Expressions in File_Header.lbl for reporting using Tracefields

In lieu of this thread getting traction : nexus.hexagon.com/.../cell-expressions-in-the-header
I wrote up this long and as detailed as I could step by step process of my own for how I created some form of data validation within PC-DMIS.
I know my methods below may be very unorthodox but I am still learning the little tricks.
If there are any questions I will respond to them tomorrow

Paste or create similar code at the beginning of your programs to prevent any issues with this working.
My job uses part numbers for naming conventions, as it's easier for our documentation and database purposes.
Enter your own parameters for Part Number if your programs are created using the actual part name.
F9 the Tracefield, and modify the value field.

For Operator ID, this can get lengthy depending how many employees you have. If this changes often, change the
TRACEFIELD/DISPLAY=NO to YES, or when in the F9 window make sure "Display" slider is on.
While in the F9 view, press the + button to keep adding more operator names, as Tracefields function as a "SelectList" in C#
or Data Validation list in Excel.

First IF Statement

  • IF/LEN(C1.INPUT)<>7 = If the length of characters of C1.INPUT(Job number input field) is not 7, do what is stated before END_IF/
  • If it isn't 7 characters, show an error message box and send them back to re-enter the Job Number. 1234567(7 digits) VALID
  • 123456(6 digits) OR 12345678(8 digits) INVALID

Second IF Statement

This one was complicated for me as I do not have much depth of knowledge in PC-DMIS expressions. We have job numbers that can contain
letters in them, and I did not know a way to filter for letters vs numbers, but I did find a way. Change variable name how you see fit.
For the first example C1.INPUT will be 1234567

  • ASSIGN/CHECKVALUE=RIGHT(LEFT(C1.INPUT, 2),1) = Value of C1.INPUT = 1234567. If you use the expression LEFT(C1.INPUT, 2) the result is "12"
  • What LEFT(string, integer) does is take that string(1234567), and find the characters left of character number specified(12).
  • We then wrap this result around a RIGHT(12, 1). Similarly to left it pulls results from right to left, so the result is 2.
  • So RIGHT(LEFT(C1.INPUT, 2),1) = 2

This was the tricky part for me, trying to detect if a letter or number was in the character 2 position.
Example above result means CHECKVALUE = 2

IF/CHECKVALUE - CHECKVALUE >= 0 = If 2 - 2 is greater than or equal to 0, throw error.

What this does here is check if CHECKVALUE can subtract itself from itself. 2 - 2
Next example I will use the C1.INPUT value of 5B43210 which will give us the result "B"

IF/ B - B >=0 cannot be calculated. So it cannot be a value greater than or equal to 0. A letter minus a letter can't be a number. So it returns value " "
So since there is a letter in this field, it does not throw an error, and continues down the code.

TRACEFIELD/DISPLAY=NO,REPORT=NO,DISPLAY MESSAGE=Verify Part Number ; Part Number : GETTEXT("PART_NAME")
TRACEFIELD/DISPLAY=NO,REPORT=NO,DISPLAY MESSAGE=Verify Operator ID ; Operator Number : Enter Number Here
C1 =COMMENT/INPUT,NO,FULL SCREEN=NO,
Enter Job Number : Example 2B99550
IF/LEN(C1.INPUT)<>7
COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,OVC=NO,
Job Number must be 7 characters long
GOTO/C1
END_IF/
ASSIGN/CHECKVALUE=RIGHT(LEFT(C1.INPUT, 2),1)
IF/CHECKVALUE - CHECKVALUE >= 0
COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,OVC=NO,
Numerical character not allowed in position 2
GOTO/C1
END_IF/
TRACEFIELD/DISPLAY=NO,REPORT=NO,DISPLAY MESSAGE=Verify Job Number ; Job Number : C1.INPUT

1. Make a backup copy of your FILE_HEADER.LBL file located at your public documents directory
example : C:\Users\Public\Documents\Hexagon\PC-DMIS\2021.2\Reporting <-- If you are using a different version
stop at : C:\Users\Public\Documents\Hexagon\PC-DMIS\ and select your proper version, then Reporting folder

2. Extract this file put into the Reporting directory, rename it back to FILE_HEADER.LBL and replace original.
Please make 100% sure you have a backup, as this will affect your report templates.
I will include an original version in case.

3. This does include a "Dimensions Out Of Tolerance" field that replaces the stats counter in the header
Green if 0, or no dimensions out of tolerance. Red for anything above 0. This color can be edited by modifying the RGB values.
I will include a version without it.

Link to .zip file : https://www.mediafire.com/file/if3vunp61bblff9/File_Header_Label.zip/file