Clarity

  • 1.  How to edit OOTB Crystal Report SQL query with parameters?

    Posted Jul 14, 2014 08:23 PM

    I'm trying to add a field to an OOTB crystal report but when i update the query in the edit command section it prompts me to enter the parameter values.  When i try entering parameter values it gives me the following error:  "Failed to retrieve data from the database.  Details: ORA-00904:: invalid identifier".  Does anyone know how to save the query without having to enter parameter values?  Or possibly figure out a way to find correct parameter values so that i'm able to save the report.  I tried running the report and exporting the crystal report and entering the parameters that show up in the "Show Current Parameter Values" section but that didn't work either. 

    Thanks,
    Aaron



  • 2.  Re: How to edit OOTB Crystal Report SQL query with parameters?

    Posted Jul 14, 2014 10:01 PM

    Many times report parameters can be obtained from the report on the BO report server. Try there also for the runtime parameters once you execute the OOB report,

     

    I also recommend you make a COPY of any OOB report and save as your custom report. Modify the saved custom report as necessary.

     

     

     

    Allen Bollinger

    Email: ebollinger@tiaa-cref.org

    Sent via i-phone



  • 3.  Re: How to edit OOTB Crystal Report SQL query with parameters?

    Posted Jul 15, 2014 10:53 PM

    Thanks Allen.  I tried getting the parameters from a report i ran in the central management console and entered it exactly as it is into crystal but it still gives me the same error.  It did not prompt me to enter the "param_host_server" or "param_plan_type" when trying to update the query in the Crystal Report command editor but those parameters don't exist in the SQL query.  All I really need to figure out is how to modify the SQL query for the report but i can't get passed the prompt to enter parameter values so i can save the query.  Any help would be greatly appreciated.
    Thank you,

    Aaron

     

     

    Parameters.jpg

     

     

     

    Crystal Parameters.jpg



  • 4.  Re: How to edit OOTB Crystal Report SQL query with parameters?

    Posted Jul 16, 2014 04:23 PM

    It appears you are trying to obtain the sql from the Storyboard report. I recommend you open this report in Crystal Report 2008 and save off a version locally to work with. From Crystal Reports, open you local copy of the report and run it. It will prompt you for parameters. Work thru these using you application version to supply the necessary internal id values (get these from the browser url string).

     

    This report appear to use the CA_Clarity_csk universe. I do not recommend modification to this universe to accomodate any custom attribute you need. You will need to develop a custom universe to support this effort. This is not a query based report. Your original post appears to indicate you are working an OOB report that is query based, and if so, please provide the actual report name, and your version of Clarity.


    Below is the query from the Project Storyboard report if you are indeed working with this report. If this is your report you want to change, you should be able to save off the report to a new version, and add additional universe fields as needed.

    SELECT PSBPD.project_id, PSBPD.project_name, PSBPD.Status_Comment, PSBPD.Description, PSBPD.Manager_ID, PSBPD.manager_name, PSBPD.approved, PSBPD.Original_StartDate, PSBPD.Actual_Start_Date, PSBPD.Original_FinishDate, PSBPD.Actual_FinishDate, PSBPD.Actuals, PSBPD.ETCSum, PSBPD.remalloc, PSBPD.PRBaseSum, PSBPD.planned_cst_total, PSBPD.planned_ben_total, PSBPD.Actual_Cost, PSBPD.EAC_COST, PSBPD.Planned_ROI FROM ( SELECT projInfo.project_id as project_id, projInfo.project_name as project_name, projInfo.Description as Description, projInfo.Manager_id as Manager_id, projInfo.manager_name as manager_name, projInfo.sponsor as sponsor, projInfo.Status_Comment as status_comment, ProjInfo.approved as approved, projInfo.Original_StartDate as original_startDate, ProjInfo.Actual_Start_Date as Actual_start_date, ProjInfo.Original_FinishDate as original_FinishDate, ProjInfo.Actual_FinishDate as Actual_FinishDate, ProjInfo.PRBaseSum as PrBaseSum,ProjInfo.planned_cst_total as planned_cst_total,ProjInfo.planned_ben_total as planned_ben_total, ProjInfo.Actual_Cost as actual_cost, ProjInfo.EAC_COST as EAC_Cost, ProjInfo.Planned_ROI as Planned_ROI, otherInfo.actuals as Actuals, otherInfo.etcsum as ETCSum, otherInfo.remalloc as remalloc FROM (SELECT p.id as project_id, p.name as project_name, p.description as Description, u.user_id as Manager_ID, CMN_CONCAT_FCT(CMN_CONCAT_FCT(u.first_name,' '),u.last_name) as manager_name, mp.prsponsoredby as sponsor, p.status_comment as Status_Comment, CASE CMN_NULL_DATE_fct(p.approvedtime,CMN_CURRENTDATE_FCT()) WHEN CMN_CURRENTDATE_FCT() THEN 'U' ELSE 'A' END as approved, sub4.start_date as Original_StartDate, p.schedule_start as Actual_Start_Date, cop_calc_finish_fct(sub4.finish_date) as Original_FinishDate, cop_calc_finish_fct(p.schedule_finish) as Actual_FinishDate, sub4.USAGE_SUM/3600 AS PRBaseSum, fin_financials.PLANNED_CST_TOTAL as planned_cst_total, fin_financials.PLANNED_BEN_TOTAL as planned_ben_total, CMN_NULL_INT_FCT(sub5.ACTUAL_COST, 0) AS Actual_Cost, CMN_NULL_INT_FCT(sub5.EAC_COST,0) AS EAC_COST, ROUND(fin_financials.PLANNED_ROI * 100,2)as Planned_ROI FROM INV_INVESTMENTS p LEFT OUTER JOIN Inv_Projects mp ON (p.id = mp.prID) left outer JOIN prj_obs_associations obs ON (p.id = obs.record_id) left outer JOIN prj_obs_units_flat obs_flat ON (obs.unit_id = obs_flat.unit_id) LEFT OUTER JOIN COP_PROJECT_ROLLUP_V sub5 ON p.id = sub5.project_id LEFT OUTER JOIN PRJ_BASELINE_DETAILS sub4 ON sub4.BASELINE_ID=P.BASELINE_ID AND sub4.OBJECT_TYPE='PROJECT' left outer JOIN odf_object_instance_mapping oim ON (P.ID = oim.primary_object_instance_id AND oim.primary_object_instance_code = 'project') INNER JOIN FIN_FINANCIALS ON (fin_financials.id = oim.secondary_object_instance_id AND oim.secondary_object_instance_code = 'financials') LEFT OUTER JOIN SRM_Resources u ON (p.manager_id = u.user_id) WHERE p.odf_object_code = 'project' AND mp.is_template = 0 AND p.IS_ACTIVE = 1 AND ( ( EXISTS (SELECT (1) FROM cmn_sec_chk_user_r_v v, cmn_sec_users usr WHERE v.user_id = usr.id AND v.object_type = 'RECORD' AND v.object_code = 'PRJ_PROJECT' AND v.permission_code IN ('ProjectViewManagement','ProjectEditManagement') AND v.component_code = 'PRJ' AND usr.user_name = @variable('BOUSER')) ) OR ( EXISTS ( SELECT (1) FROM cmn_sec_chk_user_inst_v WHERE object_instance_id = p.id AND object_type = 'RECORD' AND object_code = 'PRJ_PROJECT' AND permission_code IN ('ProjectViewManagement','ProjectEditManagement') AND component_code = 'PRJ' AND user_name = @variable('BOUSER')) ) ) AND ((obs_flat.branch_unit_id = {?PSB_Prompt1} and 0 <> {?PSB_Prompt1}) or ( 0 = {?PSB_Prompt1} )) AND (( p.id IN {?PSB_Prompt4} and 0 NOT IN {?PSB_Prompt4} ) or 0 IN {?PSB_Prompt4} ) AND ((u.user_id IN {?PSB_Prompt5} and 0 NOT IN {?PSB_Prompt5}) or 0 IN {?PSB_Prompt5} )) ProjInfo left outer join (select sub1.prprojectid, sub1.actuals, sub1.etcsum, sum(sub2.slice) as remalloc from (SELECT PRTEAM.PRPROJECTID, sum((prj_sum_assignment_fct (prteam.prid,1)/3600)/ PRJ_HPD_FACTOR_FCT()) actuals, sum((prj_sum_assignment_fct(prteam.prid,0)/3600)/ PRJ_HPD_FACTOR_FCT()) etcsum FROM SRM_RESOURCES inner join PRTeam on (SRM_RESOURCES.ID=PRTeam.prResourceID) LEFT OUTER JOIN PRJ_BASELINE_DETAILS BASEREC ON (PRTeam.PRID=BASEREC.OBJECT_ID AND BASEREC.OBJECT_TYPE='TEAM' AND 1 = BASEREC.IS_CURRENT) WHERE SRM_RESOURCES.RESOURCE_TYPE = 0 GROUP BY PRTEAM.PRPROJECTID) sub1 inner join (SELECT PRPROJECTID,PRRESOURCEID,SLICE_DATE,SLICE FROM PRJ_BLB_SLICES a inner join PRTEAM b on (a.prj_object_id = b.prid and a.slice_request_id = 10)) sub2 on sub1.prprojectid = sub2.prprojectid LEFT OUTER JOIN (SELECT P.ID,A.PRRESOURCEID, MAX(A.PRACTTHRU) AS PRACTTHRU FROM SRM_RESOURCES R inner join PRASSIGNMENT A on (r.id = a.prresourceid and r.resource_type=0) inner join PRTASK T on (a.prtaskid = t.prid) inner join INV_INVESTMENTS P on (t.prprojectid=p.id) LEFT OUTER JOIN PRJ_BASELINE_DETAILS B ON (B.BASELINE_ID=P.BASELINE_ID AND B.OBJECT_TYPE='PROJECT') GROUP BY P.ID,A.PRRESOURCEID) sub3 on (sub2.PRPROJECTID = sub3.ID AND sub2.PRRESOURCEID = sub3.PRRESOURCEID) where sub2.slice_date >= CMN_NULL_DATE_fct (sub3.PRACTTHRU,cmn_to_date_fct('01/01/1990')) group by sub1.prprojectid, actuals, etcsum) otherInfo on (projInfo.project_id = otherinfo.prprojectid) group by projInfo.project_id, projInfo.project_name, projInfo.Description, projInfo.Manager_id, projInfo.manager_name, projInfo.sponsor,projInfo.Status_Comment, ProjInfo.approved, projInfo.Original_StartDate, ProjInfo.Actual_Start_Date, ProjInfo.Original_FinishDate, ProjInfo.Actual_FinishDate, ProjInfo.PRBaseSum,ProjInfo.planned_cst_total,ProjInfo.planned_ben_total, ProjInfo.Actual_Cost,ProjInfo.EAC_COST,ProjInfo.Planned_ROI, otherInfo.prprojectid, otherInfo.actuals, otherInfo.etcsum, otherInfo.remalloc ) PSBPD



  • 5.  Re: How to edit OOTB Crystal Report SQL query with parameters?

    Posted Jul 16, 2014 06:44 PM

    sorry, i'm a little confused.  I've written some custom crystal reports and uploaded into clarity but never edited an OOTB report so i'm still really newb.  I am working on the project storyboard report on version 13.3.0.286.02.19 of clarity in crystal reports 2008 and have saved it locally to my computer.  When i open it in crystal reports and go to command the query looks different from yours.  I pasted it below so you can see it.  I just want to be able to edit this query but when i go to the command editor in crystal and make changes i get the prompt for parameters but it never seems to work when i enter it in.  I used the parameters in the picture i posted above but I don't see any values in the browser url when i run the report.  Thanks for taking the time to help out though I really appreciate it.

     

    SELECT i.id investment_key,

           i.code investment_id,

           i.name investment_name,

           CASE WHEN u.last_name IS NULL THEN NULL else u.last_name || ', ' || u.first_name END investment_manager,

           l1.name project_type,

           l4.name stage_type,

           sr1.cop_report_date current_report_date,

           l3.name project_status,

           l2.name progress,

           i.schedule_start start_date,

           b.start_date baseline_start_date,

           cop_calc_finish_fct(i.schedule_finish) finish_date,

           cop_calc_finish_fct(b.finish_date) baseline_finish_date,

           CASE NVL(sr1.cop_overall_status_color_nls,'X')

               WHEN 'Green' THEN 1

               WHEN 'Yellow' THEN 2

               WHEN 'Red' THEN 3

               ELSE 0 END c_overall_status,

           NVL(sr1.cop_schedule_status,0)/10 c_schedule_status,

           NVL(sr1.cop_scope_status,0)/10 c_scope_status,

           NVL(sr1.cop_cost_eft_status,0)/10 c_cost_effort_status,

           CASE NVL(sr2.cop_overall_status_color_nls,'X')

               WHEN 'Green' THEN 1

               WHEN 'Yellow' THEN 2

               WHEN 'Red' THEN 3

               ELSE 0 END p_overall_status,

           NVL(sr2.cop_schedule_status,0)/10 p_schedule_status,

           NVL(sr2.cop_scope_status,0)/10 p_scope_status,

           NVL(sr2.cop_cost_eft_status,0)/10 p_cost_effort_status,

           pv.obj_objective description,

           sr1.cop_report_update status_report_update,

           NVL(pv.baseline_usage,0) baseline_hours,

           NVL(pv.actuals,0) actual_hours,

           NVL(pv.etc,0) etc_hours,

           NVL((SELECT SUM(s.slice)

                FROM   prTeam t

                       INNER JOIN srm_resources r ON t.prResourceID = r.id

                       INNER JOIN prj_blb_slices s ON t.prID = s.prj_object_id

                                                  AND s.slice_request_id = 10

                                                  AND s.slice_date BETWEEN prj_max_actthru_fct(t.prProjectID, t.prResourceID)

                                                  AND LAST_DAY(prj_max_actthru_fct(t.prProjectID, t.prResourceID))

                WHERE  t.prProjectID = i.id

                AND    t.prIsOpen = 1

                AND    r.resource_type = 0) +

               (SELECT SUM(s.slice)

                FROM   prTeam t

                       INNER JOIN srm_resources r ON t.prResourceID = r.id

                       INNER JOIN prj_blb_slices s ON t.prID = s.prj_object_id

                                                  AND s.slice_request_id = 6

                                                  AND s.slice_date > NVL(LAST_DAY(prj_max_actthru_fct(t.prProjectID, t.prResourceID)),TO_DATE('01/01/1900','MM/DD/YYYY'))

                WHERE  t.prProjectID = i.id

                AND    t.prIsOpen = 1

                AND    r.resource_type = 0),0) remaining_alloc,

           sr1.cop_key_accomplish key_accomplishments,

           sr1.cop_upcoming_act upcoming_activities,

           NVL(pv.ev_acwp,0) actual_cost,

           NVL(pv.ev_etc,0) etc_cost,

           NVL(pv.planned_ben_total,0) planned_benefit,

           NVL(pv.planned_cst_total,0) planned_cost,

           cop_calc_finish_fct(pv.planned_breakeven) planned_breakeven,

           NVL(pv.planned_roi,0) planned_roi,

           NVL(pv.budget_rev_total,0) budget_benefit,

           NVL(pv.budget_cst_total,0) budget_cost,

           cop_calc_finish_fct(pv.budget_breakeven) budget_breakeven,

           NVL(pv.budget_roi,0) budget_roi

    FROM   inv_investments i

           INNER JOIN inv_projects p ON i.id = p.prID

           INNER JOIN odf_project_v2 pv ON i.id = pv.odf_pk

           INNER JOIN cop_inv_days_late_v dl ON i.id = dl.investment_id

           INNER JOIN cmn_sec_users u ON i.manager_id = u.id

           LEFT OUTER JOIN cop_prj_statusrpt_latest_v r1 ON i.id = r1.investment_id AND

                                                   r1.report_order = 1

           LEFT OUTER JOIN odf_cop_prj_statusrpt_v sr1 ON r1.report_id = sr1.odf_pk AND

                                                          sr1.odf_user_id = {?param_user_id}

           LEFT OUTER JOIN cop_prj_statusrpt_latest_v r2 ON i.id = r2.investment_id AND

                                                   r2.report_order = 2

           LEFT OUTER JOIN odf_cop_prj_statusrpt_v sr2 ON r2.report_id = sr2.odf_pk AND

                                                          sr2.odf_user_id = {?param_user_id}

           LEFT OUTER JOIN prj_baseline_details b ON i.id = b.object_id AND

                                                     b.object_type = 'PROJECT' AND

                                                     b.is_current = 1

           LEFT OUTER JOIN cop_inv_rim_stoplights_v sl ON i.id = sl.investment_id

           LEFT OUTER JOIN cmn_lookups_v l1 ON pv.obj_request_type = l1.lookup_code AND

                                               l1.lookup_type = 'OBJ_IDEA_PROJECT_TYPE' AND

                                               l1.language_code = '{?param_language}'

           LEFT OUTER JOIN cmn_lookups_v l2 ON i.progress = l2.lookup_enum AND

                                               l2.lookup_type = 'INVESTMENT_OBJ_PROGRESS' AND

                                               l2.language_code = '{?param_language}'

           LEFT OUTER JOIN cmn_lookups_v l3 ON i.status = l3.lookup_enum AND

                                               l3.lookup_type = 'INVESTMENT_OBJ_STATUS' AND

                                               l3.language_code = '{?param_language}'

           LEFT OUTER JOIN cmn_lookups_v l4 ON i.stage_code = l4.lookup_code AND

                                               l4.lookup_type = 'INV_STAGE_TYPE' AND

                                               l4.language_code = '{?param_language}'

    WHERE (p.is_program = 0)

    AND   (p.is_template = 0)

    AND   ('{?param_status}' = 'all'

    OR    ('{?param_status}' = 'approved' AND i.status IN (1,5,8))

    OR    ('{?param_status}' = 'unapproved' AND i.status NOT IN (1,5,8))) 

    AND   (0 IN {?param_investment} OR i.id IN {?param_investment})

    AND   (0 IN {?param_i_manager} OR i.manager_id IN {?param_i_manager})

    AND   (i.is_active = CASE WHEN {?param_i_active} = 0 THEN 1 ELSE i.is_active END)

    AND   ({?param_i_obs} = 0 OR

           i.id IN (SELECT obsa.record_id

                    FROM   prj_obs_associations obsa, prj_obs_units_flat obsf

                    WHERE  obsa.unit_id = obsf.unit_id

                    AND   (obsa.table_name LIKE 'INV%' OR obsa.table_name = 'SRM_PROJECTS')

                    AND    obsf.branch_unit_id = {?param_i_obs}))

    AND ((EXISTS (SELECT user_id

              FROM   cmn_sec_assgnd_obj_perm_r_v

              WHERE  object_type = 'RECORD'

              AND    object_code = 'PRJ_PROJECT'

              AND    permission_code = 'ProjectViewManagement'

              AND    component_code = 'PRJ'

              AND    user_id = {?param_user_id}))

      OR

    (EXISTS (SELECT object_instance_id

              FROM   cmn_sec_assgnd_obj_perm_v

              WHERE  object_instance_id = i.id

              AND    object_type = 'RECORD'

              AND    object_code = 'PRJ_PROJECT'

              AND    permission_code = 'ProjectViewManagement'

              AND    component_code = 'PRJ'

              AND    user_id = {?param_user_id})))

    ORDER BY UPPER(i.name)



  • 6.  Re: How to edit OOTB Crystal Report SQL query with parameters?

    Posted Jul 23, 2014 06:51 PM

    Apparently when you change attributes to an object you lose the ability to view certain tables so that is what was causing me to get the error.  I opened up a support ticket to add back the ability to view ODF_Project_V2 and it should clear up the issue.