Your Products have been synced, click here to refresh
So my next question is if i have a user input comment like this "p123456; s00024058; v433356" and only want the s00024058 string, how do I filter out or ignore the p numbers, ; , & v numbers? I want only the s numbers collected and input into a tracefield or variable.
essentially this... Masking Barcode Characters (hexagonmi.com)
Once this data is input is the format always exactly the same?
P123456; s00024058; v433356
7 characters, 9 characters, 7 characters
If this is 100% repeatable in this format, something I threw together quickly without thought for more controlled filtering.
C1 =COMMENT/INPUT,NO,FULL SCREEN=NO, Scan Barcode ASSIGN/V1=RIGHT(LEFT(C1.INPUT, 18),9) TRACEFIELD/DISPLAY=NO,REPORT=NO,DISPLAY MESSAGE=New Trace ; New Trace : V1
i found something in the help file "understanding basic file I/O concepts" --> "sample code dealing with numbers containing preceding zeros"
This is probably a dumb idea, but I created flow control for if the position of the letter "s" string begins is in any of the possible locations based on the 3 possible character positions providing your format does not change.
Feel free to share what you figured out so I can learn too.
$$ NO, s00024058; v433356; P123456 --> s is in Position 1 $$ NO, P123456; s00024058; v433356 --> s is Position 10 $$ NO, v433356; P123456; s00024058 --> s is in Position 19 C1 =COMMENT/INPUT,NO,FULL SCREEN=NO, Scan Barcode ASSIGN/V1=RIGHT(LEFT(C1.INPUT, 18),9) IF/RIGHT(LEFT(C1.INPUT, 1),1) == "s" ASSIGN/V1=RIGHT(LEFT(C1.INPUT, 9),9) GOTO/NEXT END_IF/ IF/RIGHT(LEFT(C1.INPUT, 10), 1) == "s" ASSIGN/V1=RIGHT(LEFT(C1.INPUT, 10),9) GOTO/NEXT END_IF/ IF/RIGHT(LEFT(C1.INPUT, 19),1) == "s" ASSIGN/V1=RIGHT(LEFT(C1.INPUT, 27),9) GOTO/NEXT END_IF/ NEXT =LABEL/ TRACEFIELD/DISPLAY=NO,REPORT=YES,DISPLAY MESSAGE=New Trace ; New Trace : V1
You could probably do it using the ELEMENT function - it works in a similar way to the InStr visual basic function.
Element:
Delimited substring location: ELEMENT(<Integer>, <String1>, <String2>)
This function returns the nth substring (element) from string2 using string1 as the delimiting text that divides the elements in string2.
Suppose string2 is "6, 12, 8, 4, 5" and string1 is a comma character ",". The five elements that can be individually retrieved with the element command are "6", "12", "8", "4", and "5".
Short and sweet. this works for now which i can control it depending on this configuration. thanks, ill look into the other examples also. thank you guys!
Short and sweet. this works for now which i can control it depending on this configuration. thanks, ill look into the other examples also. thank you guys!
© 2024 Hexagon AB and/or its subsidiaries. | Privacy Policy | Cloud Services Agreement |