Can somone help with a code

I have some serial numbers that look like this.


Can ysomone help with a code that says that those starting with NT410 should be added to a database.

And those starting with NT420 must be added to another database

SomeCode1 String(16)
SomeCode2 String(16)

SomeCode1 = ‘NT410-1429002716’
SomeCode2 = ‘NT420-1428005194’

If SomeCode1[1:5] = ‘NT410’
!Insert into some database
ElsIf SomeCode2[1:5] = NT420’
!Insert into another database

1 Like

Thank you very much.
It was perfect

CASE MyField[1:5] 
OF 'NT410'
  DO Something
OF 'NT420'
  DO SomethingElse
1 Like

Thank you very much.

I actually like Jeff’s version better.

I prefer CASE over IF when possible. Easier for me to read.

1 Like