Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Suppose I have a list of students and the courses they're taking. The courses they are taking are in all one field separated by '/' for each student for example:
Name Id Courses
Example 1234 C/C++/Java/Python
And I want to make a bar chart to show the popularity of these courses (how many students are taking each course). How can I add more than 1 value in the expression editor so that for the above example, the magnitude of the bars corresponding to C, C++, Java and Python all increase by 1 when a student has taken these 4 courses?
I think right way to go is to create line for each of the courses with subfield in load script:
If(Index(Courses,'/')>0,Subfield(Courses,'/'),Courses) as Courses
maybe
Subfield(Courses,'/') as chart dimension and count(distinct ID) as expression work
Temp:
load * Inline
[
Name,Id,Course
A,1,C/C++/Java/Python
B,2,Nodejs/Python
C,3,Nodejs/Java/Python
];
Final:
load Name,Id,SubField(Course,'/') as SingleCourse resident Temp;
drop Table Temp;
Hope above code helps to solve you problem.
Tab2:
LOAD *
Inline [
Name , Id , Courses
sugan , 1234 , C/C++/Java/Python
raj , 1235 , C/C++/Java,
athira , 1236 , C/C++
lak , 1237 , Java
];
for i=1 to 4
Tab3:
LOAD *, SubField(Courses,'/',$(i)) as coursenew
Resident Tab2 ;
NEXT i;
drop table Tab2;
exit Script;