cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-624430%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20Word()%20%E3%81%BE%E3%81%9F%E3%81%AF%20Words()%20%E9%96%A2%E6%95%B0%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%A6%E5%88%97%E3%81%AE%E6%96%87%E5%AD%97%E5%88%97%E3%82%92%E8%A7%A3%E6%9E%90%E3%81%99%E3%82%8B%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-624430%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E6%9C%80%E5%88%9D%E3%81%AE%E3%82%A4%E3%83%B3%E3%83%87%E3%83%83%E3%82%AF%E3%82%B9%E3%81%8C%E5%BF%85%E8%A6%81%E3%81%AA%E5%A0%B4%E5%90%88%E3%81%AF%E3%80%81N%20Items()%20%E3%81%AE%E4%BB%A3%E3%82%8F%E3%82%8A%E3%81%AB%E3%82%A4%E3%83%B3%E3%83%87%E3%83%83%E3%82%AF%E3%82%B9%E3%81%AB%201%20%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%A6%E3%81%BF%E3%81%A6%E3%81%8F%E3%81%A0%E3%81%95%E3%81%84%20(%3CA%20href%3D%22https%3A%2F%2Fwww.jmp.com%2Fsupport%2Fhelp%2Fen%2F17.0%2F%23page%2Fjmp%2Flist-functions.shtml%23ww2491421%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%E5%8D%98%E8%AA%9E()%3C%2FA%3E%20)%20%E3%81%A8%3CA%20href%3D%22https%3A%2F%2Fwww.jmp.com%2Fsupport%2Fhelp%2Fen%2F17.0%2F%23page%2Fjmp%2Fcharacter-functions-2.shtml%3Fos%3Dwin%26amp%3Bsource%3Dapplication%23ww8107571%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%E8%A8%80%E8%91%89%EF%BC%88%EF%BC%89%3C%2FA%3E%E6%A7%8B%E6%96%87%E3%81%AF%20Word(1%2C%20Vals%5Bi%5D%2C%20%22-%22)%20%E3%81%AE%E3%82%88%E3%81%86%E3%81%AA%E3%82%82%E3%81%AE%E3%81%AB%E3%81%99%E3%82%8B%E5%BF%85%E8%A6%81%E3%81%8C%E3%81%82%E3%82%8A%E3%81%BE%E3%81%99%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(1)%3B%0A%0Astr%20%3D%20%221bc5ef-gh7%22%3B%0A%0Aw1%20%3D%20Words(str%2C%20%22-%22)%3B%0Ashow(w1)%3B%0Ashow(w1%5B1%5D)%3B%0A%0Aw2%20%3D%20Word(1%2C%20str%2C%20%22-%22)%3B%0Ashow(w2)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-624483%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20Word()%20%E3%81%BE%E3%81%9F%E3%81%AF%20Words()%20%E9%96%A2%E6%95%B0%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%A6%E5%88%97%E3%81%AE%E6%96%87%E5%AD%97%E5%88%97%E3%82%92%E8%A7%A3%E6%9E%90%E3%81%99%E3%82%8B%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-624483%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EJMP%20%E3%81%AB%E3%81%AF%E7%B5%84%E3%81%BF%E8%BE%BC%E3%81%BF%E3%81%AE%20text%20to%20columns()%20%E9%96%A2%E6%95%B0%E3%81%8C%E3%81%82%E3%82%8A%E3%81%BE%E3%81%99%E3%80%82%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20default%20to%20here(1)%3B%0Adt%20%3D%20New%20Table(%22split%22%2C%20%0A%20%26lt%3B%26lt%3B%20New%20Column(%22new_batch%22%2C%20character%2C%20%26lt%3B%3CSET%20values%3D%22%22%3E%3C%2FSET%3E%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-624569%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20Word()%20%E3%81%BE%E3%81%9F%E3%81%AF%20Words()%20%E9%96%A2%E6%95%B0%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%A6%E5%88%97%E3%81%AE%E6%96%87%E5%AD%97%E5%88%97%E3%82%92%E8%A7%A3%E6%9E%90%E3%81%99%E3%82%8B%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-624569%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E5%8A%A9%E3%81%91%E3%81%A6%E3%81%8F%E3%82%8C%E3%81%A6%E3%81%82%E3%82%8A%E3%81%8C%E3%81%A8%E3%81%86%E3%80%82%20%E4%BB%A5%E4%B8%8B%E3%81%AE%E3%82%B3%E3%83%BC%E3%83%89%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%A6%E3%80%81%E3%83%87%E3%83%BC%E3%82%BF%E3%82%92%E5%8C%BA%E5%88%87%E3%82%8A%E8%A8%98%E5%8F%B7%E3%81%A7%E5%8C%BA%E5%88%87%E3%82%89%E3%82%8C%E3%81%9F%E6%96%B0%E3%81%97%E3%81%84%E5%88%97%E3%81%AB%E5%88%86%E5%89%B2%E3%81%97%E3%81%BE%E3%81%97%E3%81%9F%E3%80%82%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%20dt3%20%26lt%3B%26lt%3B%20Text%20To%20Columns(%20delimiter(%20%22-%22%20)%2C%20columns(%20%3Anew_batch%20))%3B%20%2F%2F%20strips%20out%20the%20bottle%20number%20from%20BCB%20batch%20numbers.%20Other%20chemicals%20not%20affected%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%E6%AC%A1%E3%81%AE%E5%87%BA%E5%8A%9B%E3%81%8C%E5%BE%97%E3%82%89%E3%82%8C%E3%81%BE%E3%81%99%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22JMPnoob_0-1682025571000.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JMPnoob_0-1682025571000.png%22%20style%3D%22width%3A%20238px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JMPnoob_0-1682025571000.png%22%20style%3D%22width%3A%20238px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JMPnoob_0-1682025571000.png%22%20style%3D%22width%3A%20238px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JMPnoob_0-1682025571000.png%22%20style%3D%22width%3A%20238px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JMPnoob_0-1682025571000.png%22%20style%3D%22width%3A%20238px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JMPnoob_0-1682025571000.png%22%20style%3D%22width%3A%20238px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JMPnoob_0-1682025571000.png%22%20style%3D%22width%3A%20238px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JMPnoob_0-1682025571000.png%22%20style%3D%22width%3A%20238px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JMPnoob_0-1682025571000.png%22%20style%3D%22width%3A%20238px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JMPnoob_0-1682025571000.png%22%20style%3D%22width%3A%20238px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JMPnoob_0-1682025571000.png%22%20style%3D%22width%3A%20238px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JMPnoob_0-1682025571000.png%22%20style%3D%22width%3A%20238px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JMPnoob_0-1682025571000.png%22%20style%3D%22width%3A%20238px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JMPnoob_0-1682025571000.png%22%20style%3D%22width%3A%20238px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JMPnoob_0-1682025571000.png%22%20style%3D%22width%3A%20238px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F52180i1CFEAB612C2EE946%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22JMPnoob_0-1682025571000.png%22%20alt%3D%22JMPnoob_0-1682025571000.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%E5%8A%A9%E3%81%91%E3%81%A6%E3%81%8F%E3%82%8C%E3%81%A6%E3%81%82%E3%82%8A%E3%81%8C%E3%81%A8%E3%81%86%E3%80%82%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-624570%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20Word()%20%E3%81%BE%E3%81%9F%E3%81%AF%20Words()%20%E9%96%A2%E6%95%B0%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%A6%E5%88%97%E3%81%AE%E6%96%87%E5%AD%97%E5%88%97%E3%82%92%E8%A7%A3%E6%9E%90%E3%81%99%E3%82%8B%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-624570%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E5%8A%A9%E3%81%91%E3%81%A6%E3%81%8F%E3%82%8C%E3%81%A6%E3%81%82%E3%82%8A%E3%81%8C%E3%81%A8%E3%81%86%E3%80%82%20word()%20%E3%81%A8%20words()%20%E3%81%AE%E4%BE%8B%E3%81%AF%E6%A9%9F%E8%83%BD%E3%81%97%E3%81%BE%E3%81%97%E3%81%9F%E3%80%82%20%E3%81%9F%E3%81%A0%E3%81%97%E3%80%811%E8%A1%8C%E3%81%97%E3%81%8B%E5%BF%85%E8%A6%81%E3%81%A8%E3%81%9B%E3%81%9A%E3%80%81%E3%82%88%E3%82%8A%E7%B0%A1%E5%8D%98%E3%81%A0%E3%81%A3%E3%81%9F%E3%81%9F%E3%82%81%E3%80%81%E4%BB%A5%E4%B8%8B%E3%81%AE%E3%82%B3%E3%83%BC%E3%83%89%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%99%E3%82%8B%E3%81%93%E3%81%A8%E3%81%AB%E3%81%AA%E3%82%8A%E3%81%BE%E3%81%97%E3%81%9F%E3%80%82%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%20dt3%20%26lt%3B%26lt%3B%20Text%20To%20Columns(%20delimiter(%20%22-%22%20)%2C%20columns(%20%3Anew_batch%20))%3B%20%2F%2F%20strips%20out%20the%20bottle%20number%20from%20BCB%20batch%20numbers.%20Other%20chemicals%20not%20affected%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-624393%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EWord()%20%E3%81%BE%E3%81%9F%E3%81%AF%20Words()%20%E9%96%A2%E6%95%B0%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%A6%E5%88%97%E5%86%85%E3%81%AE%E6%96%87%E5%AD%97%E5%88%97%E3%82%92%E8%A7%A3%E6%9E%90%E3%81%99%E3%82%8B%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-624393%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E3%81%93%E3%82%93%E3%81%AB%E3%81%A1%E3%81%AF%E7%9A%86%E3%81%95%E3%82%93%E3%80%81%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%E5%88%97%E3%81%AE%201%20%E3%81%A4%E3%81%AB%E8%8B%B1%E6%95%B0%E5%AD%97%E6%96%87%E5%AD%97%E5%88%97%20(%E4%BE%8B%3A%201bc5ef-gh7)%20%E3%81%AE%E5%BD%A2%E5%BC%8F%E3%81%AE%E3%83%87%E3%83%BC%E3%82%BF%E3%81%8C%E5%90%AB%E3%81%BE%E3%82%8C%E3%82%8B%E3%83%86%E3%83%BC%E3%83%96%E3%83%AB%E3%81%8C%E3%81%82%E3%82%8A%E3%80%81%E3%83%8F%E3%82%A4%E3%83%95%E3%83%B3%E3%82%92%E5%8C%BA%E5%88%87%E3%82%8A%E6%96%87%E5%AD%97%E3%81%A8%E3%81%97%E3%81%A6%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%A6%E6%96%87%E5%AD%97%E5%88%97%E3%82%92%E8%A7%A3%E6%9E%90%E3%81%97%E3%81%9F%E3%81%84%E3%81%AE%E3%81%A7%E3%81%99%E3%81%8C%E3%80%81%E6%96%87%E5%AD%97%E5%88%97%E3%81%AE%E6%9C%80%E5%88%9D%E3%81%AE%E9%83%A8%E5%88%86%E3%81%8C%E8%BF%94%E3%81%95%E3%82%8C%E3%81%BE%E3%81%99%20(%201bc5ef)%20%E3%82%92%E6%96%B0%E3%81%97%E3%81%84%E5%88%97%E3%81%AE%E3%83%87%E3%83%BC%E3%82%BF%E3%81%A8%E3%81%97%E3%81%A6%E8%BF%BD%E5%8A%A0%E3%81%97%E3%81%BE%E3%81%99%E3%80%82%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%E3%81%93%E3%82%8C%E3%81%BE%E3%81%A7%E3%81%AE%E3%81%A8%E3%81%93%E3%82%8D%E3%80%81%E4%BB%A5%E4%B8%8B%E3%81%AE%E3%82%B3%E3%83%BC%E3%83%89%E3%81%8C%E3%81%82%E3%82%8A%E3%81%BE%E3%81%99%E3%80%82%20%E7%A7%81%E3%81%8C%E4%BD%BF%E7%94%A8%E3%81%99%E3%82%8B%E5%A0%B4%E5%90%88%3CSTRONG%3E%E8%A8%80%E8%91%89%3CU%3Es%3C%2FU%3E%3C%2FSTRONG%3E%20()%20%E9%96%A2%E6%95%B0%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%99%E3%82%8B%E3%81%A8%E3%80%81%E6%96%87%E5%AD%97%E5%88%97%E3%81%AE%202%20%E7%95%AA%E7%9B%AE%E3%81%AE%E9%83%A8%E5%88%86%E3%81%AE%E3%81%BF%E3%81%8C%E8%BF%94%E3%81%95%E3%82%8C%E3%81%BE%E3%81%99%20(%E4%BE%8B%3A%20gh7)%E3%80%82%20%E3%81%9F%E3%81%A0%E3%81%97%E3%80%81%E4%BD%BF%E7%94%A8%E3%81%99%E3%82%8B%E3%81%A8%E3%80%81%3CSTRONG%3E%E8%A8%80%E8%91%89%3C%2FSTRONG%3E()%20%E9%96%A2%E6%95%B0%E3%82%92%E5%AE%9F%E8%A1%8C%E3%81%99%E3%82%8B%E3%81%A8%E3%80%81RES%20%E3%83%AA%E3%82%B9%E3%83%88%E3%81%AF%E7%A9%BA%E3%81%AB%E3%81%AA%E3%82%8A%E3%81%BE%E3%81%99%E3%80%82%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%E6%96%87%E5%AD%97%E5%88%97%E3%81%AE%E6%9C%80%E5%88%9D%E3%81%AE%E9%83%A8%E5%88%86%E3%82%92%E5%8F%96%E5%BE%97%E3%81%97%E3%81%A6%E3%80%81%E5%90%8C%E3%81%98%E3%83%86%E3%83%BC%E3%83%96%E3%83%AB%E3%81%AE%E6%96%B0%E3%81%97%E3%81%84%E5%88%97%E3%81%AB%E9%85%8D%E7%BD%AE%E3%81%97%E3%81%9F%E3%81%84%E3%81%A8%E8%80%83%E3%81%88%E3%81%A6%E3%81%84%E3%81%BE%E3%81%99%E3%80%82%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%2F%2F%20there%20is%20a%20data%20table%20that%20already%20has%20a%20column%20called%20new_batch%3CBR%20%2F%3E%3CBR%20%2F%3E%20Vals%20%3D%20%3Anew_batch%20%26lt%3B%26lt%3B%20Get%20Values%3B%20%20%2F%2F%20Get%20Values%20out%20%0A%20Res%20%3D%20List()%3B%20%2F%2F%20Define%20empty%20list%20%0A%0AFor(i%20%3D%201%20%2C%20i%20%26lt%3B%3D%20N%20Items(Vals)%2C%20i%2B%2B%2C%0A%20%20Test%20%3D%20Words(Vals%5Bi%5D%2C%22-%22)%3B%20%2F%2F%20Words%20is%20the%20function%20that%20will%20split%20your%20string%20by%20delimiter%20%0A%20%20%20Insert%20Into(Res%2CTest%5BN%20Items(Test)%5D)%3B%0A%20%20%20)%3B%0A%20%20%20dt%20%26lt%3B%26lt%3B%20New%20Column(%22new_batch_2%22%2C%20RES)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%E5%8A%A9%E3%81%91%E3%81%A6%E3%81%84%E3%81%9F%E3%81%A0%E3%81%91%E3%82%8C%E3%81%B0%E5%B9%B8%E3%81%84%E3%81%A7%E3%81%99%E3%80%82%20%E3%81%82%E3%82%8A%E3%81%8C%E3%81%A8%E3%81%86%E3%80%81%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-624393%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CLINGO-LABEL%3E%E5%93%81%E8%B3%AA%E3%81%8A%E3%82%88%E3%81%B3%E3%83%97%E3%83%AD%E3%82%BB%E3%82%B9%E3%82%A8%E3%83%B3%E3%82%B8%E3%83%8B%E3%82%A2%E3%83%AA%E3%83%B3%E3%82%B0%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Choose Language Hide Translation Bar
JMPnoob
Level II

Using Word() or Words() function to parse string in a column

Hello all,

 

I have a table where one of the columns had data that is in the form of an alphanumeric string (e.g. 1bc5ef-gh7) and I would like to parse the string using the hyphen as the delimiter and they return the first part of the string (1bc5ef) as data in a new column.

 

So far, I have the code below. If I use the Words() function, it only returns the second part of the of the string (e.g. gh7). However, if I use the Word() function, the RES list comes up empty. 

 

I would like to get the first part of the string and put it into a new column in the same table.

 

 

// there is a data table that already has a column called new_batch

Vals = :new_batch << Get Values; // Get Values out Res = List(); // Define empty list For(i = 1 , i <= N Items(Vals), i++, Test = Words(Vals[i],"-"); // Words is the function that will split your string by delimiter Insert Into(Res,Test[N Items(Test)]); ); dt << New Column("new_batch_2", RES);

 

 

Any help is appreciated. Thanks,

4 REPLIES 4
jthi
Super User

Re: Using Word() or Words() function to parse string in a column

Try using 1 for the index instead of N Items() if you want the first index (with Words()) and with Word() the syntax should be something like Word(1, Vals[i], "-")

Names Default To Here(1);

str = "1bc5ef-gh7";

w1 = Words(str, "-");
show(w1);
show(w1[1]);

w2 = Word(1, str, "-");
show(w2);
-Jarmo
JMPnoob
Level II

Re: Using Word() or Words() function to parse string in a column

Thanks for the help. The example with word() and words() worked. However, I ended up using the code below because it required only 1 line and was simpler.

 

 dt3 << Text To Columns( delimiter( "-" ), columns( :new_batch )); // strips out the bottle number from BCB batch numbers. Other chemicals not affected

 

vince_faller
Super User (Alumni)

Re: Using Word() or Words() function to parse string in a column

JMP has a builtin text to columns() function.  

 

Names default to here(1);
dt = New Table("split", 
	<< New Column("new_batch", character, <<Set Values({"1bc5ef-gh7"}))
);

dt << Text To Columns(
	delimiter( "-" ),
	columns( :new_batch )
);
Vince Faller - Predictum
JMPnoob
Level II

Re: Using Word() or Words() function to parse string in a column

Thanks for the help. I ended up using the code below to split the data into a new column separated by the delimiter.

 

 dt3 << Text To Columns( delimiter( "-" ), columns( :new_batch )); // strips out the bottle number from BCB batch numbers. Other chemicals not affected

It gives the following output

 

JMPnoob_0-1682025571000.png

 

many thanks for the help.

 

Recommended Articles