LOCAL i As Integer, n As Integer, c As String LOCAL ARRAY a1[3], a2[3], a3[4], a[3] *!* Populate the arrays and store the array lengths in a a1[1] = "a" a1[2] = "b" a1[3] = "c" a[1] = ALEN(a1) a2[1] = "A" a2[2] = "B" a2[3] = "C" a[2] = ALEN(a2) a3[1] = "1" a3[2] = "2" a3[3] = "3" a3[4] = "4" a[3] = ALEN(a3) *!* Find the maximum length of the arrays *!* In this case, 4 n = MAX(a[1], a[2], a[3]) ? "Simple Loop" FOR i = 1 TO n c = "" c = c + IIF(i <= a[1], a1[i], "#") c = c + IIF(i <= a[2], a2[i], "#") c = c + IIF(i <= a[3], a3[i], "#") ? c ENDFOR *!* Solution using a cursor CREATE CURSOR tmp (c1 C(1), c2 C(1), c3 C(1), c4 C(3)) INSERT INTO tmp (c1, c2, c3) VALUES ("a", "A", "1") INSERT INTO tmp (c1, c2, c3) VALUES ("b", "B", "2") INSERT INTO tmp (c1, c2, c3) VALUES ("c", "C", "3") INSERT INTO tmp (c1, c2, c3) VALUES ("#", "#", "4") REPLACE c4 WITH c1 + c2 + c3 ALL ? "Solution using a cursor" LIST OFF FIELDS c4