How to Use Split Function Peoplesoft in Peoplecode

How to Use Split Function Peoplesoft in Peoplecode

How to Use Split Function Peoplesoft in Peoplecode by use below syntax

Split(string, separator)

Use the Split function to convert a string into an array of strings by looking for the string separator in the given string.

For example: You read filename  from your path and split file for write it to report.

&file_name = %FilePath | &Attachsysfilename;
MessageBox(0, “file_name”, 0, 0, ” &file_name= ” | &file_name);

&In_File = GetFile(&file_name, “E”, %FilePath_Absolute);

If &In_File.IsOpen Then
While &In_File.ReadLine(&file);

     &line = Split(&file, “,”);

      &EMPLID = &line [1];
      &EFFDT   = &line [2];
      &EFFSEQ = &line [3];

   /* Each statement */

end-while;

end-if;

 

ref:https://docs.oracle.com/cd/E13292_01/pt849pbr0/eng/psbooks/tpcl/chapter.htm?File=tpcl/htm/tpcl02.htm%23g037ee99c9453fb39_ef90c_10c791ddc07__3c45

Posted in Peoplecode, PeopleSoft.