Search code examples
arrayscrystal-reportssharedstandard-deviation

Crystal Reports - Standard Deviation of data from 2 sources


I have 2 subreports that return data from customer satisfaction surveys. One for Incidents Loggedand one for Requests Logged.

Both have the same 5 questions.

I need to combine the results to find the standard deviation for each question to present in a main report.

eg.

In report 1 field {usr_incidentsurveyquestion1.ubr_rank} gives results 4,3,4,4,5,3 In report 2 field {usr_requestsurveyquestion1.ubr_rank} gives results 3,4,5,4,3

so in the main report I need 4,3,4,4,5,3,3,4,5,4,3

I've hit a brick wall trying to use a shared array.

Is this possible? Any pointers appreciated.

Edit----------------------------------------------------------

whileprintingrecords;
shared numbervar Array IncSurvey; 
shared numbervar n; 
n:=n+1; 
redim preserve Incsurvey[n]; 
Incsurvey[n] :={usr_incidentsurveyquestion1.ubr_rank};

Solution

  • ok by seeing your question and formula looks like you are not using your formula coorectly:

    in sub report 1 use your formula and place in the group or detail whereever you are placing the field so that every data will be added up

    whileprintingrecords;
    shared StringVar Array IncSurvey1; 
    
    Incsurvey1 :=Incsurvey1 + totext({usr_incidentsurveyquestion1.ubr_rank});
    1
    

    If the whole string is coming as one value then use as below:

    whileprintingrecords1;
    shared StringVar Array IncSurvey; 
    
    Incsurvey1 :=totext({usr_incidentsurveyquestion1.ubr_rank});
    1
    

    Repeat the same for second sub report aswell.

    Now in main report go to the section that is coming after the sub report section and write below in formula:

       shared StringVar Array IncSurvey1;  //sub report 1
       shared StringVar Array IncSurvey2;  //sub report 2
    
     Join(IncSurvey1+IncSurvey2,",")