[Pe...] Posted February 24 Share Posted February 24 Hi I am currently trying to map Machine No ($K10) with a formula as some of the gauge inputs are varying. Most of the equipment inputs are ok , but one of the vendors is sending $K10 as text rather than numerical which copies over a number with 6 spaces. For example Machine No is "1420", but comes into auto importer as "1420 ", this means the machine catalog is unable to match. I have attempted the following script which is not working, I do not have a manual for this I am not sure if one is available? {if String.Length($K10) = 10 then String.Substring($K10,0,4) else $K10} - I am attempting to check if the length=10chrs and if so trims from the start of the string to 4 chrs. I would appreciate any advice KR Pete Link to comment Share on other sites More sharing options...
[An...] Posted February 24 Share Posted February 24 Hi Pete, I have a couple of thoughts. The first is that you could try String.Trim instead of String.Substring. If I use the following: ${String.TrimEnd("1240 ", "")} returns "1240" as a string with no trailing white space. You could also convert the String to an Int. ${ToInt("1240 ")} returns 1240 as an integer which cannot have trailing white space. I also believe that is you used one of these, you wouldn't have to do the If Else check. Hopefully one of these helps. Let me know and I'll see if I can find another method that better suits your needs. Best Regards, Andy Block 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