Morph Question re: to nth Character

Is there a way using “morph” to strip text ahead of say the 4th underscore in the example below? We’re setting up a variable data print job that will call the file name, but we also need to break out the school code, grade, and teacher.

Example: ATA_F19_06_Archibald_Ackerman, Emma.jpg

Use arraytlast(theField,"_") as the morph formula where theField is the field containing the long string. In your example:

arraylast("ATA_F19_06_Archibald_Ackerman, Emma.jpg","_") ☞ Ackerman, Emma.jpg

Thanks for that, Gary. I’d already figured out how to get everything after the last . Now I’m trying to get everything before the "" so I can bust out the Teacher, Grade & Location. I “misspoke” when I said “strip” up above. I really need to keep just everything before the 4th underscore in the new field and I can take it from there…

I tried the same thing using “arrayfirst” and it returns ATA in the above example where I’d like to be left with “ATA_F19_06_Archibald_”

Got it Gary once I realized that F19 was common to all the strings, I was able to break it apart from there. Thanks for the assist! I always learn things here!

I know you have your solution but I thought I’d put out another alternative approach. You can use arrayrange( to get the first 4 elements or the array( function to pick out individual elements of the string.

1 Like