>a sample of the data >ID NAME MARK SUBJECT >1 AAA 11 MATH >1 AAA 12 BIOLOGY >1 AAA 12 ENGLISH >1 AAA 14 CIVIC >1 AAA 15 HISTORY >2 BBB 7 CHEMSTRY >2 BBB 2 MATH >2 BBB 22 BIOLOGY >2 BBB 21 MATH >3 CCC 31 MATH >3 CCC 34 CIVIC >3 CCC 35 HISTORY >3 CCC 37 ECONOMIC >THIS TABLE SHOULD BE CONVERTED TO ANOTHER TABLE AS FOLLOW > >STUDENT ID NAME SUBJECT 1 SUBJECT 2 SUBJECT 3 SUBJECT 4 SUBJECT 5 >1 AAA MATH BIOLOGY SPANISH CIVIC HISTORY >2 BBB MATH BIOLOGY >>this is where exactly I stack since 10 days, if only I can create a report horizentaly from a vertical table my problem is solved.
1. Select distinct subject from Report into cursor c_UniqueSubjects nofilter 2. local lcSubjects, lnCount, lcSubjects = "" select c_UniqueSubjects lnCount = 0 scan lcSubjects = ", " + Subject + " I" local &Subject endscan 3. create cursor c_FinalResult (iID I, cStudentName C(40) &lcSubjects) && If this would not work, we can construct the whole create cursor command as a string index on iID tag iID 4. select Report set order to StudentID scan if not seek(StudentID, 'c_FinalRersult') insert into c_FinalResult (iID, cStudentName) values (Report.ID, Report.Name) endif store Reprt.Mark to ("m." + Subject) replace (Subject) with ("m." + Subject) in c_FinalResult endscanAll of this from the top of my head and not tested/optimized, but should give you an idea.