anandknr
Member
hi all,
I am very new to progress so please help to find the solution .
I have a db table with 4 fields ....
Table - student
columns - rollno,name,std,grade.
now i have to display sorted listed of students but sorting condition is to be choose d by user through a drop down. So i need to change the ' break by ' field accordingly.
here is the logic i used .
def var sortParam as character no-undo .
sortParam = /* gets drop down selected field value to sort */
if sortParam = "rollno" then do:
for each student by rollno :
/* dispaly to user*/
end .
end .
if sortParam = "name" then do:
for each student by name :
/* dispaly to user*/
end .
end .
if sortParam = "std" then do:
for each student by std :
/* dispaly to user*/
end .
end .
the problem here is that ,a lot of code redundancy is here as i am using same display code in all for each loop.
Can any one suggest a better method for this .
I am very new to progress so please help to find the solution .
I have a db table with 4 fields ....
Table - student
columns - rollno,name,std,grade.
now i have to display sorted listed of students but sorting condition is to be choose d by user through a drop down. So i need to change the ' break by ' field accordingly.
here is the logic i used .
def var sortParam as character no-undo .
sortParam = /* gets drop down selected field value to sort */
if sortParam = "rollno" then do:
for each student by rollno :
/* dispaly to user*/
end .
end .
if sortParam = "name" then do:
for each student by name :
/* dispaly to user*/
end .
end .
if sortParam = "std" then do:
for each student by std :
/* dispaly to user*/
end .
end .
the problem here is that ,a lot of code redundancy is here as i am using same display code in all for each loop.
Can any one suggest a better method for this .