Hello PC DMIS community
I am creating a report header that uses tracefields to bring values back to the header (i.e. Shop Order, Employee ID, etc.)
Input comments allow the operator to input the information, and the tracefields take the info back to the header.
C1 =COMMENT/INPUT,NO,FULL SCREEN=NO,
SHOP ORDER
C2 =COMMENT/INPUT,NO,FULL SCREEN=NO,
EMPLOYEE ID
C3 =COMMENT/INPUT,NO,FULL SCREEN=NO,
SAMPLE NUMBER
TRACEFIELD/DISPLAY=NO,REPORT=NO,DISPLAY MESSAGE=CELL ; SHOP ORDER : C1.INPUT
TRACEFIELD/DISPLAY=NO,REPORT=NO,DISPLAY MESSAGE=EMPLOYEE ; EMPLOYEE ID : C2.INPUT
TRACEFIELD/DISPLAY=NO,REPORT=NO,DISPLAY MESSAGE=SAMPLE ; SAMPLE ID : C3.INPUT
The generic format for the all part numbers in this family is 8154(Diameter/Length)-01
So the example shown 815409239-01 would be a 9 mm Diameter, 239 mm length.
I have forms set up to acquire the diameters and lengths through a radio button selection list (bubble button). So the information I need for each part number is being collected in the program already.
I am confused by the syntax when I come to constructing the variable.
ASSIGN/PART_NUM=8154+DIAMETER+LENGTH
does the same, calculates the sum.
How do I get the text to reflect the DIAMETER and LENGTH variables as display text, without adding the values?
So, if the variable DIAMETER is 09 and LENGTH is 239, the line will read "815409239"?
Thank you in advance for any help! You guys are the best
You need to indicate the values want to be strings.
ASSIGN/PART_NUM=STR("8154")+STR(DIAMETER)+STR(LENGTH)
You can use FORMAT to define the output format of DIAMETER or LENGTH
ASSIGN/PART_NUM=STR("8154")+FORMAT("%02d",DIAMETER)+FORMAT("%03d", LENGTH)
I think.
The "%02d" tells pcdmis the output has 2 places with a leading 0 if less than 9. The "%03d" does the same but for 3 places.
You need to indicate the values want to be strings.
ASSIGN/PART_NUM=STR("8154")+STR(DIAMETER)+STR(LENGTH)
You can use FORMAT to define the output format of DIAMETER or LENGTH
ASSIGN/PART_NUM=STR("8154")+FORMAT("%02d",DIAMETER)+FORMAT("%03d", LENGTH)
I think.
The "%02d" tells pcdmis the output has 2 places with a leading 0 if less than 9. The "%03d" does the same but for 3 places.