I would create a data-model in the form of two matching arrays and then just look up the value in the first one and use the matching index to retrieve the part-name. It's easier shown than explained, I think:
var values = ["0000001", "0000002", "0000003"]; // etc. var partNames = ["Part Item A", "Part Item B", "Part Item Z"]; // etc. var i = values.indexOf(event.value); if (i!=-1) this.getField("#POP.P").value = partNames[i]; else this.getField("#POP.P").value = "";
This is basically all the code you need. You just fill in both arrays with the values, and you're done.
Thank you so much, I just test out the script you wrote and it works perfect. The one you provided is more organize and looks completely simple. I just need one more value input, or how to rewrite the following from the switch script:
this.getField(POPGrid).value = "Invalid HPID Item";
Basically, if the user enter the values wrong, it needs to output that it is a "invalid item number".
That's what the last line of my code does. I used a blank string, but you can replace it with an error message, if you wish.
I understand now, thanks again!