Peoplesoft peoplecode application engine logic - multiple row insertion with one string

703 views Asked by At

I need to store a value in database in column. The value I m getting is combination of four string. I need to break the value and insert it in every row through peoplecode in app engine. E. G. My value is A1. 9876.B2 5432. The value is separated by dot delimiter. I need to store it like

Tbl          column1
     1.       A1
     2.       A1. 9876
     3.       A1. 9876.B2
     4.       A1. 9876.B2.5432

Along with other column values and flag setting based on level data. Please let me know how to achieve this. So 4 rows need to be inserted. It might vary till 3 levels also. I have started like splitting the whole value into 4 variables but unable to build up the logic to insert these values rowwise.

1

There are 1 answers

0
jaromir On BEST ANSWER

If I understand correctly you can do it in a simple loop.

&array = Split(&value, ".");
&valueToInsert = &array[1];

For &i = 1 To Len(&array)
   If &i > 1 Then
      &valueToInsert = &valueToInsert | "." | &array[&i];
   End-If;

   SQLExec("Your insert statement");
   REM Or you can use Record class;
End-For;