The Record select is excluding rows

The following record select formula, is not showing rows which we want to see. The user passes a month and year param and then we show the not sold
for that month year as well as the previous month.
However, we do want to show rows that did not sell for the entire year and even years back. This formula is only showing the rows that had some sales in the past 2years. It's better use for management to see all items not selling also years back to the last sale.
if {?Month}=1 then
    (({SUMPRT.IQA01} =0  and {SUMPRT.IQYER#} = {?Year}) and ({SUMPRT.IQA12} =0  and {SUMPRT.IQYER#} = {?Year}-1))
else if {?Month}=2 then
    ({SUMPRT.IQA01} =0 and {SUMPRT.IQA02} =0 ) and {SUMPRT.IQYER#} = {?Year}
else if {?Month}=3 then
    ({SUMPRT.IQA02} =0 and {SUMPRT.IQA03} =0 ) and {SUMPRT.IQYER#} = {?Year}
else if {?Month}=4 then
    ({SUMPRT.IQA03} =0 and {SUMPRT.IQA04} =0 ) and {SUMPRT.IQYER#} = {?Year}
else if {?Month}=5 then
    ({SUMPRT.IQA04} =0 and {SUMPRT.IQA05} =0 ) and {SUMPRT.IQYER#} = {?Year}
else if {?Month}=6 then
    ({SUMPRT.IQA05} =0 and {SUMPRT.IQA06} =0 ) and {SUMPRT.IQYER#} = {?Year}
else if {?Month}=7 then
    ({SUMPRT.IQA06} =0 and {SUMPRT.IQA07} =0 ) and {SUMPRT.IQYER#} = {?Year}
else if {?Month}=8 then
    ({SUMPRT.IQA07} =0 and {SUMPRT.IQA08} =0 ) and {SUMPRT.IQYER#} = {?Year}
else if {?Month}=9 then
    ({SUMPRT.IQA08} =0 and {SUMPRT.IQA09} =0 ) and {SUMPRT.IQYER#} = {?Year}
else if {?Month}=10 then
    ({SUMPRT.IQA09} =0 and {SUMPRT.IQA10} =0 ) and {SUMPRT.IQYER#} = {?Year}
else if {?Month}=11 then
    ({SUMPRT.IQA10} =0 and {SUMPRT.IQA11} =0 ) and {SUMPRT.IQYER#} = {?Year}
else if {?Month}=12 then
    ({SUMPRT.IQA11} =0 and {SUMPRT.IQA12} =0 ) and {SUMPRT.IQYER#} = {?Year}

hi Paul,
if you've got a situation where your query is not bringing back all combinations of the records that you want, and no combination of table joins (e.g. left outer or right outer) and record filter syntax gives you the results you need, then you may want to start thinking about creating a command object or stored procedure that produces / brings back those records.
so, if your database does not include a value for product A sold in january 2014, then you may need to manufacture that record.
this particular blog post will show you 3 different methods of bringing back product & month combinations.
i hope this helps,
jamie

Similar Messages

  • Database DLL error on editing the record selection formula?

    Post Author: Aravind
    CA Forum: Older Products
    Hi All,I recently edited the record selection formula of an old report and since then the report is issuing me an "Error detected by database DLL" error.The report was running fine earlier and still continues to run fine if I undo the changes. Earlier, the records were selected based on a 'date' field and I edited the formula to select records based on another date field, but the report doesn't work.The report runs fine on my local PC using Crystal Reports, but web based reporting fails with the error message. The data is selected from a view and the date parameters I talked about are the fields in the same view.This view has around five date parameters and the report runs fine for all of them, except one date field.Any pointers are appreciated.Crystal reports version is 8.5. Regards,Aravind.

    Post Author: DPowell
    CA Forum: Older Products
    Ah, yes, the good old generic date error.
    The problem is likely an invalid date value in one (or all) of your records with that field.  You don't say what database engine you are connected to or which driver you are using for the report, but I'll give you some "pointers".
    Basically, the SQL fetch has encountered an error in your date field and the driver you are using in the report can't handle it.
    A null date could cause that problem.  Also a date-time field with an invalid value or truncated time value.  A robust ODBC driver, like one of the Microsoft drivers might be able to overcome it.  Likewise, vendors frequently release updated drivers to improve error handling just like this.
    1.  Analyze your data, specifically the contents of the "new" date field you are using for some kind of invalid date.
    2.  Experiment with different ODBC drivers by creating alternate ODBC connections to the same database using different ODBC drivers.
    3.  Browse and experiment with options in Crystal Reports Properties that allow you to specify data conversions for NULLs and Dates.
    Good luck !

  • Variable selection criteria in the record selection

    Variable selection criteria in the record selection with Crystal Report with SQL 2005 Server tables.
    In the record selection I would like to use the value of the field u201CsSQL1u201D as part of the selection criteria instead the field name {tblReportAccessAutority.sSQL1}
    The value of the field {tblReportAccessAutority.sSQL1} is {tblSalesReporting.sJEDivisionCode} = 'I'
    I tried with formulas, SQL expressions, but nothing works.
    Record selection of the report:
    {tblReportAccessAutority.sUserID} = CurrentCEUserName
    and {tblSalesReporting.sLegalEntity} = {?Legal Entity}
    and {tblSalesReporting.sJEPeriod} = {?PARAM_PERIOD}
    and {tblSalesReporting.sIG3rd} =  {?PARAM_IG3RD}
    and {tblReportAccessAutority.sSQL1}                           <---this is the problem line
    The field {tblReportAccessAutority.sSQL1} is not converted in the value:
    {tblSalesReporting.sJEDivisionCode} = 'I'     
    The tables tblSalesReporting and tblReportAccessAutority are joined in this report.
    Many thanks for your help.
    Roger

    How is the syntax for the selection criteria in the record selection?
    {tblReportAccessAutority.sUserID} = 'ch1scro2'
    and {tblSalesReporting.sLegalEntity} = {?Legal Entity}
    and {tblSalesReporting.sJEPeriod} = {?PARAM_PERIOD}
    and {tblSalesReporting.sIG3rd} = {?PARAM_IG3RD}
    and SELECT {@sSQL_Condition} ???????? or
    and  {@sSQL_Condition} ??????? or how?
    The expression fir the formula {@sSQL_Condition} is:
    TOTEXT({tblReportAccessAutority.sSQL1})
    The field definition for {tblReportAccessAutority.sSQL1} is nvarchar(50).
    Thanks Roger

  • How can i change the record selection criteria via SDK?

    Hi,
    I wanna change the record selection criteria  in rpt file in java program, What API is required?
    Thanks.
    Forest

    Hi,
    You can use RAS API to change record selection formula at runtime. Go to
    https://www.sdn.sap.com/irj/boc/index?rid=/webcontent/uuid/f0aea666-5384-2b10-ffb0-a6facef1d5e5
    and look for Report Application Server Java SDK Feature Samples. It contains the record selection change code.
    Thanks
    Aasavari

  • How to get the record selected in ztable based record in the output of alv

    Hi All,
    I have developed a report, it is displaying the output in ALV format.The list contained some 20 fields along with MATERIAL and BATCH. I have provided menu bar as extras -> ztable(it also contained MATERIAL and BATCH). But I have some issue when I select any record in the output then go to
    path extras -> ztable, it has to select the record in ztable based MATERIAL and BATCH which i have selected in the output, then can you please provide solution for the above problem.
    Thanks in advance

    Hi Dolly,
    you can do this by,
    data: index_rows type lvc_t_row,
          index like line of index_rows.
    * Get Selected rows from alv grid
      clear index_rows.  refresh index_rows.
    "When you choose extras->ztable
      call method alv_grid->get_selected_rows
               importing
                     et_index_rows = index_rows.
    * Now delete those rows from the ALV grid
      loop at index_rows into index.
        read table itab index index-index. "Lets say itab is the table you are displaying
        if sy-subrc = 0.
         perform bdc_sm30. "do simple bdc for sm30 with tab name and selected values
        endif.
      endloop.
    Regards,
    Manoj Kumar P
    Edited by: Manoj Kumar on Feb 23, 2009 2:49 PM

  • How to get the current selected column and row

    Hi,
    A difficult one, how do i know which column (and row would also be nice) of a JTable is selected?
    e.g.
    I have a JButton which is called "Edit" when i select a cell in the JTable and click the button "Edit" a new window must be visible as a form where the user can edit the a part of a row.
    Then the column which was selected in the JTable must be given (so i need to know current column) and then i want the TextField (the one needed to be edited) be active with requestFocus(). So it would be
    pricetextfield.requestFocus();
    Problem now is that i have to click every time in the window the JTextField which was selected in the JTable. I have chosen for this way of editing because my application is multi-user and it would be too difficult for me when everybody did editing directly (catch signals, reload data, etc.).
    My question is how do I know the current column and the current row in a JTable?

    I'm not sure what your mean by the "current" row or column, but the following utility methods return
    which row and column have focus within the JTable.
    public static int getFocusRow(JTable table) {
        return table.getSelectionModel().getLeadSelectionIndex();
    public static int getFocusColumn(JTable table) {
        return table.getColumnModel().getSelectionModel().getLeadSelectionIndex();
    }

  • How to restrict the default selection of first row in ALV  in Webdynpro

    Hi Experts,
    In webdynpro i used ALV to display the bulk amount of datas under a view container. While running it ll cme by default selection on first row. how to restrict that.....

    Hi Vimal,
    Whenever we create nodes then by default the Initialization lead selection property of  node is always checked. That why in the alv by default the first row is selected.
    To restrict this default selection just unchecked the Initialization lead selection property of your node.
    Regard
    Manoj Kumar

  • How do we capture the record selected in the table control?

    Hi,
      In the table control when the user selects a record we need to capture that record and pass it to the next screen.how can we do this?
    Thanks,
    Rakesh.

    Hello
    First of all you need a 'mark' column in your TC structure.This should be char1.
    This column has to be put into the TC Attributes as mark column.
    Then to get back the info from the TC go the following way:
    PAI
    loop at <fs_it> .               "Field symbol of your table.
        MODIFY <fs_it> FROM wa_basic
        INDEX tc_maintenance-current_line.
    endloop.
    Message was edited by:
            Werner Gerbert

  • How to restrict the record selection for PLPO table .

    Hi,
    Am selecting 'plnnr' and 'vornr' from PLPO table . For one Plnnr their are multiple Vornr including 0001 & 9999.
    I want to select only those entries which have only Vornr 0001 & 9999.
    Ex : 1) Plnnr - 5689
               Vornr - 0001,2536,8989,9999
           2) Plnnr - 8787
               vornr -  0001
           3) Plnnr - 5936
               vornr -  9999
           4) Plnnr - 2345
               vornr -  0001,9999
    Here for this example i want to select only the entry with Plnnr = 2345 as it only contains 0001 & 9999.
    Can any one let me know how to get this in a select query.
    Your help is much appreciated.
    Thanks in advance.   
    Ravi Kasnale.

    Hi
    Try with below code
    RANGES:r_vornr FOR plpo-vornr.
    TYPES:BEGIN OF ty_plpo,
    plnnr TYPE plpo-plnnr,
    vornr TYPE plpo-vornr,
    END OF ty_plpo.
    DATA:it_plpo_temp TYPE STANDARD TABLE OF ty_plpo.
    DATA:it_plpo TYPE STANDARD TABLE OF ty_plpo.
    DATA:it_plpo_temp1 TYPE STANDARD TABLE OF ty_plpo.
    DATA:wa_plpo_temp1 TYPE ty_plpo.
    DATA:v_line TYPE sy-tabix.
    START-OF-SELECTION.
      r_vornr-sign = 'I'.
      r_vornr-option = 'EQ'.
      r_vornr-low = '0000'.
      CLEAR:r_vornr-high.
      APPEND r_vornr.
      r_vornr-sign = 'I'.
      r_vornr-option = 'EQ'.
      r_vornr-low = '9999'.
      CLEAR:r_vornr-high.
      APPEND r_vornr.
      SELECT plnnr vornr FROM plpo INTO TABLE it_plpo_temp1 WHERE vornr IN r_vornr.
      CLEAR:it_plpo[].
      LOOP AT it_plpo_temp1 INTO wa_plpo_temp1.
        CLEAR:it_plpo_temp[].
        it_plpo_temp[] = it_plpo_temp1[].
        DELETE it_plpo_temp WHERE plnnr <> wa_plpo_temp1-plnnr.
        DESCRIBE TABLE it_plpo_temp LINES v_line.
        IF v_line EQ '2'.
          APPEND LINES OF it_plpo_temp TO it_plpo.
        ENDIF.
      ENDLOOP.
      SORT it_plpo BY plnnr.
      DELETE ADJACENT DUPLICATES FROM it_plpo COMPARING plnnr.
    Regards
    Srilaxmi

  • Record selected in the table control

    Hi All,
      How do i know the line no of the record selected in the table control.I have declared a table control CONTROLS : t_control1 type tableview using screen 200.But in t_control1-current_line the line no that is stored is always 1.
    Thanks,
    Rakesh.

    in table control property window you have to set that suppose you have set itab-mark as the sel field then it will always be X if you select the field ...
    regards
    shiba dutta

  • How to display record selection settings in the result

    Hi,
    CR 2008 and 2013 are being used, but this is a rather general question.
    We are generating different schedules using one source file. Depending on the filter setting on the data scope, say CURRRENTDATE or last month, daily or monthly reports are sent out.
    The problem is, when there is no data included in the report, we would like to put a message in the report saying "There is no data found in the period xyz". But so far we haven't figured out how to retrieve the different filter settings in the schedules.
    Is there a way to do this? I do hope we don't have to create different .rpt files just for different schedules.
    Any suggestions and opinions are appreciated.

    While, the reports can be run manually by the user with a prompt asking the range or scheduled on the server and sent out automatically without interaction.
    For the latter case, the prompt for date range was written as optional. And the record selection looks like this:
    IF (HASVALUE({?dFrom}) AND  HASVALUE({?dTo}))
    THEN
    {a_table.dDate}>={?dFrom}) AND {a_table.dDate}<={?dTo}
    With the user input, everything is ok. But while scheduling a report on the server, we set the prompt to EMPTY and control the range by using a filter. For a daily report, the record selection changes to
    {a_table.dDate}= CURRENTDATE-2
    Here comes the problem. Without being able to read this value into the report, we don't know how to show period xyz in an empty report, because a daily report could also query CURRENTDATE or CURRENTDATE-10, depending on the schedule. The same applies to monthly reports. People can schedule a report to run once a month, but still query just CURRENTDATE by mistake.
    So the most reliable information is to read out what is set in the filter...

  • Parsing an input parameter for the where clause or record select value

    In my limited CR experience, I've always used a command database connection so that I can write my own SQL.  However, now I have to parse a  pipe delimited parameter to get my value for the where clause, so I'm selecting several tables and joining them through the Database Expert Links tab.  All works fine, but after doing that and then parsing the parameter with the below formula in the Select Expert, I notice that there is no where clause in the SQL query, and although the report eventually displays the proper values, it runs through thousands of records first.  Here is my Select Expert - Record formula:
    StringVar array Parm1;
    Parm1 := Split({?DATA_AREA}, "|");
    {SO_ORDERS.CASE_ID} = Parm1[2]
    If I change "Parm1[2]" on the last line to a valid Case ID, then there is a where clause in the SQL and the report generates immediately. 
    It seems like the record select formula is applied AFTER all of the records (without a where clause) are searched when I use the parsed parameter value, but when I hard code a valid value, it places that into the where clause BEFORE the sql is executed.  Is there a way to get the parameter parsed first and then use that parsed value in the SQL where clause?
    Thanks.
    Bill

    Yes crystal will run the query first to get 100% data and then applies record selection condition. To increase the performance you need to pass the where condition at the command level instead of report level. So you need to create a report using add command like this
    select * from tablename where field={?Parameter}
    {?Parameter} is a command level parameter.
    Now insert this report as a subreport in another report which has no connection but has a parameter
    {?DATA_AREA} and create a formula like this in the main report
    Split({?DATA_AREA}, "|")[2]
    Now right click on the subreport and go to change subreport links and add this formula from main report and link this to sub report parameter {?Parameter} without linking any database field from the subreport.
    Now your subreport runs with the where clause to get the data.
    Regards,
    Raghavendra

  • Record Selection in Japanese not pulling the correct records.

    Hello,
    I am using Crystal XI running off of a Remedy SQL Database that has Japanese data in the records.  When I place the following criteria in the Record Selection, I pull no records.  But, If the put the criteria with the japanese criteria in the Group Selection formula, I get the records that I want but then many of my formulas are adding up all the records.
    {HPD_HelpDesk_VW.Severity} in ["1","2"] and
    {HPD_Affected_Organizations.Organization} like "ジブラルタ"
    How can I get Crystal to recognize the japanese criteria in the Record Selection criteria?
    Any help would be appreciated.
    Thanks, Stacy

    Hello,
    I am using Crystal XI running off of a Remedy SQL Database that has Japanese data in the records. When I place the following criteria in the Record Selection, I pull no records. But, If the put the criteria with the japanese criteria in the Group Selection formula, I get the records that I want but then many of my formulas are adding up all the records.
    {HPD_HelpDesk_VW.Severity} in \"1\",\"2\" and
    {HPD_Affected_Organizations.Organization} like "ジブラルタ"
    How can I get Crystal to recognize the japanese criteria in the Record Selection criteria?
    Any help would be appreciated.
    Thanks, Stacy

  • Controlling Record Selection for Subreports from the Main Report

    Post Author: Horizon57
    CA Forum: Formula
    Hello - I am generating a standard report template that will be applied to all of my accounts and I am connecting to an Access DB that has multiple tables. Each table corresponds to a single Subreport within my Mainreport and contains the data for all of the accounts. Essentially I would like to be able to write some logic in the Formula section of my Mainreport whereby I can control which account to run the report for based on the Account Name.  I am having sucess with this method when I change the parameters of the formula in each subreport, but how do I modify my code to allow me to control this from the mainreport.  An example of a formula is below. // Account AAA//{Subreport1.Account } = "AAA" and {Subreport2.Account } = "AAA" and {Subreport3.Account } = "AAA" and {Subreport4.Account } = "AAA"// Account BBB//{Subreport1.Account } = "BBB" and {Subreport2.Account } = "BBB" and {Subreport3.Account } = "BBB" and {Subreport4.Account } = "BBB"// Account CCC//{Subreport1.Account } = "CCC" and {Subreport2.Account } = "CCC" and {Subreport3.Account } = "CCC" and {Subreport4.Account } = "CCC" Essentially, I am looking to just uncomment the particular Account I would like to produce the report for and have that filter down to all the subreports. How do i Modify the logic? Is there a better way to approach this?

    Post Author: Horizon57
    CA Forum: Formula
    Thanks for all the responses..... Just to clarify, I am essentially trying to control the record selection of each subreport with a forumula in the mainreport. To this end I am trying to avoid having to modify the formula in each subreport to change accounts each time i need to run a set of reports. I am still not having any luck modifying the subreport links as mentioned above. The only way I have been able to control the data is with formulas in each subreport. If anyone has accomplished what I am attempting, could you post an actual formula from both the subreports and mainreport so I can try to mirror them. Also, if anyone can point me to an example where I can integrate a dialog box to automatically control the record selection (as mentioned above), that would be great. Thanks,Mike

  • Date Format in Record Selection

    Hello,
    I have a problem where the Crystal Report is not returning all the rows that meet the record selection criteria because I believe there is a problem with the date format.
    My record selection criteria is:
    ( {EMPOS.POS_STARTC} <= {@EB_EDATE} and {EMPOS.POS_ENDD} >= {@EB_SDATE} ) or
        IsNull({EMPOS.POS_ENDD} )
    where EB_EDATE and EB_SDATE are formula fields with the values Date(2011, 12, 31) and Date(2011, 01, 01) respectively which returns the format of DD/MM/YYYY used by the FinanceOne (F1) ERP application that we run the report from.  Both formula fields are overriden by the run parameters in the same date format in F1.
    If I were to run the SQL below in a query tool like Toad, it returns a row where pos_startc is 1/01/2011 and pos_endd is null, that is not included in the report.
    select * from empos where det_numbera = '01285'
                          and ( (pos_startc <= '20111231' and pos_endd >= '20110101') or pos_endd is null )
    1. Why is Crystal Reports excluding this row when the date format is different?
    2. How can I change the criteria (or format) to include the one of many other rows missing?

    Hello,
    Crystal Reports is now returning all rows where pos_endd is null in the database with the record selection criteria of:
    {CHRIS_EmpSal.pos_endd} = date(0, 0, 0)
    However, when I run it in Finance One, it doesn't like this date format   Is there another way to get both Crystal and Finance One (i.e., SQL Server DB) to recognise the same syntax for null dates?

Maybe you are looking for

  • S_ALR_87012168 - Amount difference

    Hi Experts how can I know where I can check on standard program (S_ALR_87012168) on output type Graphical report-output last record value extraction. For example, next information how can I know where system extract the data, because in last record t

  • Help! While downloading Lion, I lost WIFI and got error message  . . .

    While downloading Lion, I lost WIFI and got error message "An error has occurred." Tried to re-download and the dowload icon says "OSX Lion--Waiting . . . " Please help!! What should I do?

  • Can't sort out the following errors...

    continued from routing system message..... *****CODE**** package routingSystem; public class Router { //attributes private Machine machineArray[]; //this array is of type Machine. the name // could be different. private Machine packingMachine; //The

  • How to hide perticular column when we repeat column ?

    Hi members, i have one problem. i have years in my elements. i am displaying this each distinct year as a column in template. for that i write this sysntax . <?for-each-group@column:ROW;./FISCAL_YEAR?> but when fiscal_year = 2000 then i need to hide

  • Why cant I see my external hard disk on finder?

    I disconnected mt external backup disk without ejecting it first, now it doesn't show in Finder when I connect it. Is there anything I can do?