Saved Data Selection Formula

Hi...
I need some help in creating a Saved Data Selection formula. The data source is a SQL Server Stored Procedure which returns a number of fields including 16 'flag' fields which can contain either a 0 or a 1.
The client wants to select which 'flag' fields will be used to filter the report, interactively changing the selection(s).
Any number of fields could be selected, or just 1.
The parameter has values 1-16 along with a description. The description is what the user sees. The parameter is named 'Indicator'
I'm stumbling over the fact that the formula has to return a boolean.... I tried:
if not hasvalue({?Indicator}) or {?Indicator}=0  then 1=1;
    if hasvalue({?Indicator}) and {?Indicator} = 1 and {p_rpt_Customer_AutoHigh.is_314a}
    or hasvalue({?Indicator}) and {?Indicator} = 2 and {p_rpt_Customer_AutoHigh.is_auto}
    or hasvalue({?Indicator}) and {?Indicator} = 3 and {p_rpt_Customer_AutoHigh.is_autohigh_update}
etc.....
    then 1 = 1
    else 1=0;
but I'm not certain how to construct the logic because at the end of all this, I need a THEN... which makes no sense...
I've created Saved Data Selects before, but there were specific tests that were applied, for examplde....
if hasvalue({?Parameter}) and {?Parameter}=1 then {field) in LastFullWeek
These were discrete user selections, not multiple selections, and the 'test' was concrete - this in there!
Any help you could provide would be welcome....

A: Saved Data Selection Formula

You don't actually have to have an If statement for this.  Your comparisons all evaluate to true or false anyways  So, what you can do is something like this:
(not hasvalue({?Indicator}) or {?Indicator}=0) or
({?Indicator} = 1 and {p_rpt_Customer_AutoHigh.is_314a} ) or
({?Indicator} = 2 and {p_rpt_Customer_AutoHigh.is_auto} ) or
({?Indicator} = 3 and {p_rpt_Customer_AutoHigh.is_autohigh_update}) or
Notice where I've put the parentheses - these are very important for getting this to work correctly.
Note also that you don't have to include "hasvalue()" in all of the lines.  This is because of the way Boolean expressions are processed.  Because of the "or", Crystal will only process until it hits the first "true" result.  If {?Indicator} doesn't have a value, it will be caught with the "not hasvalue({?Indicator})" in the first line and none of the rest of the formula will be processed.
-Dell

You don't actually have to have an If statement for this.  Your comparisons all evaluate to true or false anyways  So, what you can do is something like this:
(not hasvalue({?Indicator}) or {?Indicator}=0) or
({?Indicator} = 1 and {p_rpt_Customer_AutoHigh.is_314a} ) or
({?Indicator} = 2 and {p_rpt_Customer_AutoHigh.is_auto} ) or
({?Indicator} = 3 and {p_rpt_Customer_AutoHigh.is_autohigh_update}) or
Notice where I've put the parentheses - these are very important for getting this to work correctly.
Note also that you don't have to include "hasvalue()" in all of the lines.  This is because of the way Boolean expressions are processed.  Because of the "or", Crystal will only process until it hits the first "true" result.  If {?Indicator} doesn't have a value, it will be caught with the "not hasvalue({?Indicator})" in the first line and none of the rest of the formula will be processed.
-Dell

Similar Messages

  • Saving data selected in dropdown to databse

    hi ,
    please guide me how to save data selected from a dropdown to the database.

    Hi,
    You simply read the node bind to that dropdown, and collect it in variable or itab. then process as u want,
    read the node using get_attribute method.
    Yogesh N

  • Short dump while saving data after selecting '#' for variable in WI

    Hello All,
    We have a selection variable in our webinterface on company code.After selecting '#',i am entering data and while saving it goes to dump.
    but client wants to have an error message displayed after saving data instead of runtime error (dump).so that user can select required company code.
    Error analysis is:
    A RAISE statement in the program "SAPLRSDRI" raised the exception   
    condition "ILLEGAL_INPUT".                                          
    Since the exception was not intercepted by a superior program       
    in the hierarchy, processing was terminated.                        
    Short description of exception condition:                           
    For detailed documentation of the exception condition, use          
    Transaction SE37 (Function Library). You can take the called        
    function module from the display of active calls.                   
    Is there any way to get desired  result?
    Thanks

    Hello Murali,
    What you would need to do is to change the attributes of the variable.
    1. In BPS0, you can make it as a mandatory entry.
    2. In the web layout, you can create a variable for Company code and force the user to choose a value from a dropdown list.
    The specific approach would depend on how the layout is being called and how it has been setup.
    Hope this helps.
    Sunil

  • What if I implement data level security using Selection formula?

    Hi All,
    I have a requirement to implement data level security for all the reports, the thing is, we donot have a front end application developed in java/.net or any other language, so we have only two options (as per me, if you think there are other alternatives then please share).
    1) Implement security at the database level (that is use user roles in where clause which will make the where clause really complicated and hence the performance of the query will eventually decrease).
    2) Retrieve the data with the flags of user role/permission on data. Use these flags in selection formula to select the needed records as per the user login.
    I have already in middle of implementing the second method, thought to take suggestion from you guys, I appreciate if you could tell me the drawbacks of the method I am using, and if there is an alternative method you could think of.
    Thanks,
    -Azhar

    Standaone Crystal Reports does not have any security option except to use Trusted Authentication when connecting to the DB. We use Microsofts NT or MS SQL Server Authentication only.
    Doing this in CR Designer using flags and formula will never be secure, the user could simply change the formula etc...
    Check with your DBA on how to configure AD authentication and then enable or add each user to SQL server. You may need to configure and mantain this manually depending on how you ahve your network configured.
    Thank you
    Don

  • Selection formula not selecting by dates

    I'm having an odd problem with my report. I'm trying to filter by the start date of a job. The DB I'm pulling from stores it as a string, YYYMMDD (e.g. today is 20090713). In most of my reports it works just fine, but in this one it seems that it's ignoring the filter altogether.
    My original selection formula was:
    {JobMaster.StartDate} IN {?FromDate} to {?ToDate}
    In an effort to 'fix' it, I changed it to:
    DateSerial(ToNumber(Mid({JobMaster.StartDate},1,4)),ToNumber(Mid({JobMaster.StartDate},5,2)),ToNumber(Mid({JobMaster.StartDate},7,2))) >= DateSerial(ToNumber(Mid({?FromDate},1,4)),ToNumber(Mid({?FromDate},5,2)),ToNumber(Mid({?FromDate},7,2)))
    AND
    DateSerial(ToNumber(Mid({JobMaster.StartDate},1,4)),ToNumber(Mid({JobMaster.StartDate},5,2)),ToNumber(Mid({JobMaster.StartDate},7,2)))
        <= DateSerial(ToNumber(Mid({?ToDate},1,4)),ToNumber(Mid({?ToDate},5,2)),ToNumber(Mid({?ToDate},7,2)))
    I noticed that it even grabs jobs July, even if I pass the FromDate as 20080601 and ToDate as 20090601. The startdate I'm dealing with is 20090702.
    Any ideas? Thanks in advance.

    Hi Lain,
    Do the following :
    Create single Date parameter and in options allow range values true.  Now in your record selection you gie = {?Date}
    Thanks,
    Sastry

  • Using Date Range parameter in Subreport Selection Formula

    I have a subreport which includes this line in the selection formula:
    {Production.Date} = {?Pm-?DateRange}
    {?Pm-?DateRange} appears in the Subreport Links window, so it seems like it should work.
    The DateRange parameter is set by the user in the Main report.
    But the subreport returns no records.
    I tried this:
    In the Main report I created a StartDate and a StopDate field from {?Pm-?DateRange} .
    Then in the subreport selection formula I used these two formula fields like this:
    {Production.Date} >= @StartDate
    and
    {Production.Date} <= @StopDate
    This works!
    So I have found a workaround, but still, I don't understand why the original code {Production.Date} = {?Pm-?DateRange} returns no records.
    Thanks,
    Art

    Hi Art,
    You cannot use a date range parameter directly in the subreport's record selection formula.
    You'll need to create a formula in the Main report like this:
    Minimum(?DateRange) //This gives the start date
    Maximum(?DateRange) //This gives the end date
    Then send these formulas as parameters to subreport for use in the record selection formula.
    I think you've already got this figured out anyway!
    -Abhilash

  • Select formula works with one set of data but not another??

    Post Author: rkckjk
    CA Forum: Formula
    I have the folloing Select formula:{Sheet1_.Assign Group History} = '{"COMPUTER OPERATIONS"}' and{Sheet1_.Resolved By Group} = "COMPUTER OPERATIONS"That I'm using to select records from an Excel spreadsheet. It works fine with the Jan. 2008 spreadsheet file: Test MTTR Jan 2008.xlsbut not with the Feb. 2008 spreadsheet: Test MTTR Feb 2008.xlsWhen I use the Feb. 2008 file I get this error:"Query Engine Error:'Error code: 0x800a06ff Source: DAO.Recordset Description: this expression is typed incorrectly, or it is too complex to be evaluated."Basically both Excel files are in the same format but have different data in them. I don't understand why Jan's works, but not Feb's???
    Since, I can't upload the two files without contacting the system administrator, maybe someone can help me debug the error code or how to debug this error using another method or idea??

    Post Author: sharonmtowler
    CA Forum: Formula
    did you try each sheet while removing one of the select statements?  i would start there and try feb with no select statement, add one in, then the next
    see what is causing your problem. it sounds like some data in the xls file is in an incorrect format.

  • CRVS2010 Beta - Database login fails after setting select formula

    I am working through how to call the report and have it print programatically.  I was able to get it to print with the saved data, but as soon as i add a recordSelectionFormula to it, it fails saying the login is incorrect.  I have searched the forums and tried the different resolutions some people have used, but it still fails for me.  What about the select formula would cause this issue?  below is the code i am using.  Please let me know what I am missing, thank you.
                ReportDocument crDoc = new ReportDocument();
                crDoc.Load("c:
    shipmgmt
    reports
    PackingSlip.rpt");
                crDoc.SetDatabaseLogon("user", "password", "localhost", "shipmgmt");
                crDoc.RecordSelectionFormula = "{ld_mstr.ldm_nbr} = \"13994\" AND {ld_mstr.ldm_ord} = \"665527\"";
                Object sfVal = new Object();
                sfVal = "R&S COLUMBIA";
                Object prncases = new Object();
                prncases = false;
                crDoc.SetParameterValue("shipFrom", sfVal);
                crDoc.SetParameterValue("prnCases", prncases);
                crDoc.PrintOptions.PrinterName = "
    wc-printserver
    wccsr";
                crDoc.PrintToPrinter( 1, false, 0, 0 );
                crDoc.Dispose();

    Hello,
    Copy the record selection formula from the Designer and paste that into your code, then use a report without the record selection formula saved in it and test again.
    Next step is what database and driver are you using? Joinbuilder registry keys were for old legacy drivers. This may be an issue with the driver configuration.
    ALSO, don't use "localhost" as your Server name or DSN name etc. Try replacing it with the actual DB server/machine name:
    crDoc.SetDatabaseLogon("user", "password", "localhost", "shipmgmt");
    Thanks again
    Don

  • Report prints Saved Data not Refreshed Data

    We were running VS 2005 and using the Basic CR 2005 Basic that comes with it.  We upgraded to use CR 2008 and found MANY issues after we went live in production that were apparent in the development.  This has caused a lot of stress with us as well as our users.  Iu2019ll summarize everything we found, possible workarounds and the open issues including the Printing/Loading of Saved Data.
    First, it was reported that printing changed.  It turns out when PrintMode = u2018PDFu2019 (default setting) it now asks after you choose u2018EXPORTu2019 (use to be u2018OKu2019) that it asks to Open or Save the Adobe.  When our customers were running 20 some reports at a time and we had hundreds of users, this became a nuisance for the heavy reporting users and a training issue in general for us.  With research, I found that we can change the PrintMode to be u2018ActiveXu2019.  This was much better when we were testing.  However, in Production it became a nightmare.  If the user is on a Domain that disallows itu2019s user from installing software or if the user has tight security settings, this became a nightmare.
    The second thing reported was that it was exporting to the wrong format.  It was exporting into RPT format.  It turns out with CR2008, it automatically defaults to RPT and the new pop-up, doesnu2019t isnu2019t clear to the user they even have a choice (the pop-up is much prettier, but it doesnu2019t look like a dropdown anymore).  In addition, they reported it was taking twice as long to export (we think it was related to export file type now).  With CR2005 Basic, it would have no default selection and if the user didnu2019t pick one, it would remind them they need to pick one.  After much research, I found there is no way to customize the operation of the export without writing my own export.  My users 90% of the time want to export to PDF and Excel the rest of the time.  Since we arenu2019t using a CR Server like product, they NEVER will do RPT.  There is no way with CR2008 to limit this list or to default the File Format.  So now, if they forget to select the type, they get the wrong file format instead of being reminded to select one.  Since the new pop-upu2019s dropdown selection isnu2019t easily apparent, this was a BIG issue for us.  Since I have close to 300 reports on 7 websites, this will be a lot of work for me to write my own code and change all the ASPX page to use my own control.
    The third thing reported was that the default name on Exporting was changed.  Export uses the ID property of the Crystal Report Viewer as the default name of a file on export.  When it replaced the viewer on all our pages, it set the ID to CrystalReportViewer1 instead of preserving the original ID.  We now have to go back and change them to what we wanted manually.  BEAWRE of this!  For our power users who wanted to export 40 reports they now have type the name in manually on all of them.  What took minutes now takes over an hour for them to do, until we can fix all the pages.
    Now it was reported that some reports are showing OLD data.  It turns out there shows Saved Data from design time.  In our site, we have a parameter page which getu2019s user selected parameters, save to a session and then load the report page using the session variables, and then redirect them to the report page which on page load we set the reports parameters.  We use the CrystalReportSource using ODBC.  The report has all the connection information.  Well if the user happens to select the same parameters I used at design time, it wonu2019t pull the data from the database.  They see our test data instead which is garbage.  If they select different parameters, display the report and then go back and select the original parameters, they will get the correct data.  This can be catastrophic for us!  So I added at the beginning of the Page Load before setting parameters the following:
         If Not Page.IsPostBack Then
                CRSServiceAlertsReport.ReportDocument.Refresh()
         End If
    This seemed to work.  A pain to add on every report page though when it wasnu2019t necessary before.  But then I just got called this morning and they say when they print, it prited the OLD data.  It seems the refresh pulled new data and updated the display in the viewer but the ActiveX print still used the original Saved Data!  I couldnu2019t find a solution for this.  I found switching PrintMode back to u2018Pdfu2019 worked but now I have the extra click issue again, which I described above.  I tried setting the reports u2018Discard Saved Datau2019 option but it still had the data!
    In the end, had I known about all these issues I would have NEVER upgraded to CR2008.  Iu2019m still looking for help on getting by the following:
    u2022     Stop using Saved Data at runtime (either on Display or Print)
    u2022     Getting the PrintMode=u2019Pdfu2019 to just pull up Adobe in Open mode without prompting the user.
    u2022     Remove File Type options from Export
    u2022     Set the default File Type options to nothing or something I want.
    Another nice feature to have would be the ActiveX control for printing to be part of the .NET Framework so users donu2019t need to download it.  Come on BO is a big company Iu2019m sure they can work with MS.  

    What is that method to clear Saved Data; I looked and couldn't find it.  I never had to call one in the prior version of CR 2005 Basic in .Net.  With the .NET controls, it always refreshed the data before.  This is a change in behavior for me.
    As for the Print using Adobe, with CR2005 Basic, it didn't prompt the user to Open or Save before.  This is new behavior.  It used to just open the report in Adobe in memory before without this specific prompt (it did have the first prompt for All or specific pages, but it would just open after that).  This is a change in behavior from prior versions and it has caused me several issues. 
    Many users don't like change and I didn't know to communicate this to them.  They were taken by surprise.  We'll learn to live it I guess, but I would ask you just to consider, why have an option to "Save" to PDF when you choose to print?  I would think you would use Export if you want to save.  It would never hurt to add an option to allow alternatives either.
    As for including with .NET Framework, it was just an idea.  I know how hard it can be working with third parties.  However, given that CR Basic comes with it, I thought it may be possible to work with them.  The better the integration the better the product is for the developers.  I was thinking the button could call JavaScript/Java to print instead of an ActiveX, or some other method.  Since I donu2019t know how the Control works, I couldnu2019t say.  It just would be nice.  I had a smiley face after that request, it didn't come out right when I saved the post.
    I still don't understand why .Refresh will update the data in the viewer but printing using the ActiveX Control will still print the saved data instead of refreshed data.  Since I never used this in the prior version I don't know what it would of done or not, but it just doesn't seem right it shows one set of data, and prints another.
    In addition, why the designer still saves data with the report when you state not to, I think may be a problem still.
    Edited by: Thomas Johnson on Nov 21, 2008 12:26 PM

  • How do I use a running total within a selection formula?

    I am developing a report within Crystal Reports 2008.  My goal is to identify any accounts that have zero usage for at least six months in this current year.  I have account number, meter size, read date, usage, and a running total/subtotal by account.
    Here is what the data looks like in the report
    ACCTNO     METER SIZE   READ DATE/TIME               READ_USAGE    Counter
    001022-05                    
    001022-05     2.00              9/28/2009  9:42:00 AM      0.00                     1
                                                                                    1
    001110-09               
    001110-09     2.00             3/2/2009  9:54:13 AM         0.00                      1
    001110-09     2.00             3/26/2009  1:32:28 PM        0.00                      1
    001110-09     2.00             4/27/2009  11:02:11 AM     0.00                      1
    001110-09     2.00             5/27/2009  1:13:53 PM        0.00                      1
    001110-09     2.00             6/19/2009  11:41:20 AM     0.00                      1
    001110-09     2.00     9/1/2009  8:13:25 AM         0.00                      1
                                                                                    6
    My report shows all accounts that have zero usage.  I want to filter the report to only show the accounts that have at least six zero usage reads.  I thought I could add a running total, sum it, and filter the data by using the selection formulas.  Unfortunately I keep getting an error message saying "this field cannot be used becuase it is being evaluated later."  Any help would be appreciated.  This is the first report I have created using crystal.
    Edited by: smwdrw2 on Oct 28, 2009 4:29 PM

    You could Conditionally suppress the account numbers where your running total is less than 6
    You will probably have to put your account number summaries in the group footer, instead of the header.
    Then:
    go to the section expert, click on the group footer for the account number, on the right, next to the word "Suppress" click on the box that says "X-2". In the formula put
    IF<6 then True
    Save and close
    The only way this would not work for you is if you have some sort of grand total that you don't want to include the other groups in.

  • Error (ORA-01403) saveing data form a report with apex_item items

    Hi all,
    I've a problem saveing data that's inserted into a report which I created using apex_item items. Reproducing the exact issue on apex.oracle.com will take me a lot of time, and I don't know if I really can reproduce this matter... So I hope I can explain my problem clearly enough, here...
    The global story of the application is that its an application used for measureing objects. For these objects there are templates, with default properties. When measureing an object, the user must fill in those properties for the object. The report is build dynamicly, becouse each object has different properties and each property could be of an other kind (number, text, list, counter [=number field with add and substract buttons], and date). Depending on the type of the property, the report has to show an other item to fill.
    The query for constructing this report is like this:
    select defprop.proptyp_id,
    apex_item.hidden(41,defprop.id) defprop_id,
    defprop.nam,
    decode(proptyp.id,
                    1, apex_item.text(p_idx=>42,p_value=>''||
                        decode(defprop.srt, 'CONSTANT', (select WRD
                                                                            from    measurement_prop
                                                                            where    defprop_ID = defprop.id
                                                                            AND        measurement_id IN
                                                                                (SELECT ID
                                                                                FROM measurement
                                                                                WHERE OBJ_ID = obj.id
                                                                                AND DAT IN
                                                                                    (SELECT latest_date
                                                                                    from object_instance
                                                                                    WHERE ID = obj.id)))
                     ||'' ,p_attributes=>'class=case5_num'),
                    2, apex_item.text(p_idx=>42,p_value=>''||
                        decode(defprop.srt, 'CONSTANT', (select WRD
                                                                            from    measurement_prop
                                                                            where    defprop_ID = defprop.id
                                                                            AND        measurement_id IN
                                                                                (SELECT ID
                                                                                FROM measurement
                                                                                WHERE OBJ_ID = obj.id
                                                                                AND DAT IN
                                                                                    (SELECT latest_date
                                                                                    from object_instance
                                                                                    WHERE ID = obj.id)))
                     ||''),
                    3, apex_item.select_list_from_query(p_idx=>42,p_value=>''||
                        decode(defprop.srt, 'CONSTANT', (select WRD
                                                                            from    measurement_prop
                                                                            where    defprop_ID = defprop.id
                                                                            AND        measurement_id IN
                                                                                (SELECT ID
                                                                                FROM measurement
                                                                                WHERE OBJ_ID = obj.id
                                                                                AND DAT IN
                                                                                    (SELECT latest_date
                                                                                    from object_instance
                                                                                    WHERE ID = obj.id)))
                     ||'', p_query=> 'select wrd, id from property_typewrd where proptyp_id = ' || proptyp.id ||' order by vlgnum', p_show_null=> 'NO'),
                    4, apex_item.text(p_idx=>42,p_value=>''||
                        decode(defprop.srt, 'CONSTANT', (select WRD
                                                                            from    measurement_prop
                                                                            where    defprop_ID = defprop.id
                                                                            AND        measurement_id IN
                                                                                (SELECT ID
                                                                                FROM measurement
                                                                                WHERE OBJ_ID = obj.id
                                                                                AND DAT IN
                                                                                    (SELECT latest_date
                                                                                    from object_instance
                                                                                    WHERE ID = obj.id)))
                     ||'',p_attributes=>'class=case5_num')
                    || '<a name="add_f02" href="#"><img alt="add" src="#WORKSPACE_IMAGES#plusBig.gif"/></a>    '
                    || '<a name="sub_f02" href="#"><img alt="sub" src="#WORKSPACE_IMAGES#minusBig.gif"/></a>',
                    5, apex_item.date_popup(p_idx=>42, p_value=>''||
                        decode(defprop.srt, 'CONSTANT', (select WRD
                                                                            from    measurement_prop
                                                                            where    defprop_ID = defprop.id
                                                                            AND        measurement_id IN
                                                                                (SELECT ID
                                                                                FROM measurement
                                                                                WHERE OBJ_ID = obj.id
                                                                                AND DAT IN
                                                                                    (SELECT latest_date
                                                                                    from object_instance
                                                                                    WHERE ID = obj.id)))
                     ||''),
                    oms
                ) waarde
    from default_property defprop,
    object_instance obj,
    property_type proptyp
    where defprop.stdobjver_id = obj.stdobjver_id
    and defprop.proptyp_id = proptyp.id
    and obj.id = :P2200_ID_INVThis report works fine. Depending on the type of the property it shows a numberic field, text field, selectlist (with right values), counter field or date field.
    If the default property is set to a 'CONSTANT' value, the last known value is filled in.
    With a javascript I check the numberic field value and achieve the counterfield to add or substract values when 'plus' or 'minus' is clicked.
    This javascript is placed in the field 'Execute when Page Loads' in the page properties in APEX. Here is the code:
    /*Execute when page loads*/
    /*Allow only numbers */
    number_elem = $('input[name=f42].case5_num');
    number_elem.keypress(function(event) {
      if (event.which && (event.which < 46 || event.which > 57 || event.which == 47) && event.keyCode != 8) {
          event.preventDefault();
      if (event.which == 46 && $(this).val().indexOf('.') != -1) {
          event.preventDefault();
    //for mouse events, remove any non numeric characters
    number_elem.bind('mouseup mousedown mouseleave', function(event) {
       this.value = this.value.replace(/[^0-9]/g, '');
    /* Subtract Button */
    $('a[name="sub_f42"]').click( function() {
      number_elem = $(this).siblings('input[name=f42].case5_num');
      currVal = number_elem.val();
    if ( isNaN( currVal) ){
       elemVal = 0;
    else {
       elemVal = Number(currVal);
    if (elemVal > 0)
         number_elem.val(elemVal-1);
    else
    { elemVal = 0; }
    /* Add Button */
    $('a[name="add_f02"]').click( function() {
      number_elem = $(this).siblings('input[name=f42].case5_num');
      currVal = number_elem.val();
    if ( isNaN( currVal) ){
       elemVal = 0;
    else {
       elemVal = Number(currVal);
    number_elem.val(elemVal+1);
    });Those two codes makes my report works fine. So far I'm happy. But now I want the data, which the user fills in the items, to be saved.
    So I created a process that should do this for me (it wil run after the user hits a button), here is the code:
    declare
         v_objmet_id number := 0;     
    begin
         select measurment_seq.nextval
         into v_objmet_id
         from dual;
         insert into measurment
         ( id
         , obj_id
         , dat
         values
         ( v_objmet_id
         , :P2200_ID_INV
         , :P2200_METDAT_INV
         /*Loop trough the values (g_f42 holds the value of the property)*/     
         for i in 1 .. apex_application.g_f42.count loop
              /*g_f41 holds the key to the default property*/
              if apex_application.g_f41(i) is not null and
                   apex_application.g_f41(i) > 0 then
                   insert into measurment_prop
                   ( measrument_id
                   , defprop_id
                   , wrd)
                   values
                   ( v_objmet_id
                   , apex_application.g_f41(i)
                   , apex_application.g_f42(i)
              end if;
         end loop;
    end;After running this process, the application branches back to the page, clearing the cache and set some items I use for filtering an other report with their own values.
    Both the process and the branche have a 'when button pressed' condition, where the same button is filled in. The branche fires on submit: after processing.
    When I hit the button to save the data, I get an error: ORA-01403: no data found
    In the debug info I can find there is encountered an unhandeled exception in the process, but I don't know what's going wrong...
    I thought it could be something with the date field, I want to save, so I put it in a to_date() with the right format, but I still got the error...
    I've also checked if the query which fetches the nextval of the sequence is correct, and it is, no typeing error in the sequence name, or something.
    I'm using APEX 4.0.2
    Edited by: Mir on 28-jun-2011 10:25
    Changed some code of the javascript, it directed to the wrong item ID, now its correct

    My problem is solved. The error occured when application item g_f41 was accessed, so my application couldn't find the data, the user putted in there. I now pasted this part of the sql, to the other apex_item field, so it became one field and now it works correctly:
    select [...]
    apex_item.hidden(41,defprop.id) ||
    decode(proptyp.id,
                    1, apex_item.text(p_idx=>42,p_value=>''||
                        decode(defprop.srt, 'CONSTANT', (select WRD
                                                                            from    measurement_prop
                                                                            where    defprop_ID = defprop.id
                                                                            AND        measurement_id IN
                                                                                (SELECT ID
                                                                                FROM measurement
                                                                                WHERE OBJ_ID = obj.id
                                                                                AND DAT IN
                                                                                    (SELECT latest_date
                                                                                    from object_instance
                                                                                    WHERE ID = obj.id)))
    [... etc ...]

  • I have a question about General Data Selection in Report Painter

    Please help me out. Thi is the question....here it goes.
    In a Report in ReportPainter, I have in the General Data Selection the following selected characteristics. They are:
    Ledger = 0
    Record Type = 0
    Version = 1
    Fiscal Year = Z-ANOACT
    Period = (1CPERIV, 1CPERIB)
    So that we have the next screen in the Report’s execution.
    Fiscal Year : 2006
    From Period : 1
    To Period : 12
    Note:
    *Z-ANOACT = Variable so that with a user-exit calculates the actual year. Right now is 2006.
    *1CPERIV = This From-Period Variable is referenced to CCSS Table and PERBL Field Name. Its default value is 1.
    *1CPERIB = This To-Period Variable is referenced to CCSS Table and PERBL Field Name.
    Its default value is 12. Rigth now, we are in the fiscal month 5 (November).
    Id like to filtrate information from January,2006,Period:07 to November,2007,Period:05.
    I mean I work with the fiscal calendar because the information to get from the table is saved due to this calendar.
    The Fiscal Calendar is from July to June:
    Month          Period     Year
    January          07     2006     
    February     08     2006
    March          09     2006
    April          10     2006     
    May          11     2006                   
    June          12     2006
    July          01     2007
    Augost          02     2007
    September     03     2007     
    October          04     2007
    November     05     2007
    December      06     2007
    Right now, we are in November , 2006 (month=11) but according to the fiscal calendar we are in November, 2007 (month=5).
    How I can accommodate my variables or what I am doing wrong so that I can select information from periods 7 to 12, 2006 ( January to June, 2006) and information from periods 1 to 5, 2007 (July to November, 2007) having the screen cited above so that report painter adds the 2 ranges.
    I cannot do it with the criteria selection cited above because I only have a year and a range of periods and my end-user doesnt want to run my report twice:
    One run with periods 7 to 12, 2006 and
    Another run with periods 1 to 5, 2007 and then to add the 2 reports in excel to form a report.
    Hed like something in my screen like this……
    Fiscal Year = 2006
    From period = 7
    To Period = 12
    Fiscal Year = 2007
    From period = 1
    To Period = 5
    And then report painter will add the 2 ranges.
    Many Thanks if you know anything that can help me, please let me know.

    Please help me out. Thi is the question....here it goes.
    In a Report in ReportPainter, I have in the General Data Selection the following selected characteristics. They are:
    Ledger = 0
    Record Type = 0
    Version = 1
    Fiscal Year = Z-ANOACT
    Period = (1CPERIV, 1CPERIB)
    So that we have the next screen in the Report’s execution.
    Fiscal Year : 2006
    From Period : 1
    To Period : 12
    Note:
    *Z-ANOACT = Variable so that with a user-exit calculates the actual year. Right now is 2006.
    *1CPERIV = This From-Period Variable is referenced to CCSS Table and PERBL Field Name. Its default value is 1.
    *1CPERIB = This To-Period Variable is referenced to CCSS Table and PERBL Field Name.
    Its default value is 12. Rigth now, we are in the fiscal month 5 (November).
    Id like to filtrate information from January,2006,Period:07 to November,2007,Period:05.
    I mean I work with the fiscal calendar because the information to get from the table is saved due to this calendar.
    The Fiscal Calendar is from July to June:
    Month          Period     Year
    January          07     2006     
    February     08     2006
    March          09     2006
    April          10     2006     
    May          11     2006                   
    June          12     2006
    July          01     2007
    Augost          02     2007
    September     03     2007     
    October          04     2007
    November     05     2007
    December      06     2007
    Right now, we are in November , 2006 (month=11) but according to the fiscal calendar we are in November, 2007 (month=5).
    How I can accommodate my variables or what I am doing wrong so that I can select information from periods 7 to 12, 2006 ( January to June, 2006) and information from periods 1 to 5, 2007 (July to November, 2007) having the screen cited above so that report painter adds the 2 ranges.
    I cannot do it with the criteria selection cited above because I only have a year and a range of periods and my end-user doesnt want to run my report twice:
    One run with periods 7 to 12, 2006 and
    Another run with periods 1 to 5, 2007 and then to add the 2 reports in excel to form a report.
    Hed like something in my screen like this……
    Fiscal Year = 2006
    From period = 7
    To Period = 12
    Fiscal Year = 2007
    From period = 1
    To Period = 5
    And then report painter will add the 2 ranges.
    Many Thanks if you know anything that can help me, please let me know.

  • "Missing parameter values." Error when setting record selection formula

    Setup - VS 2008, CR 2008 (v12.0), Win XP & C#.Net
    I have a form which loops through all parameters (non-linked to sub reports, so only off the main report) and allows users to enter the values for each parameter. When hitting the preview button, I loop through all of the saved values, set the parameter field values and then add any additional filters into the recordselection formula as below. The problem i'm having is that the ReportDocument.HasRecords returns true if the ReportDocument.RecordSelectionFormula doesn't filter out every result.
    For example, I have a list of customers and if I set the selection formula to filter out a specific customer, ReportDocument.HasRecors returns true, if I set the selection formula to filter something that doesn't exist i.e. customer "xk39df", the moment this line of code runs "ReportDocument.RecordSelectionFormula = rsFormula;" - ReportDocument.HasRecors returns the following exception as opposed to "False".
    Message: Missing parameter values.
    Source: CrystalDecisions.ReportAppServer.DataSetConversion
    StackTrace:    at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)
       at CrystalDecisions.CrystalReports.Engine.ReportDocument.hasRecords()
       at CrystalDecisions.CrystalReports.Engine.ReportDocument.get_HasRecords()
    ErrorID: MissingParameterFieldCurrentValue
    The strange thing is, it works fine if the recordselectionformula selects a record which exists in the results - all parameters have a current value except for the linked parameters.
    This one has got me stumped!
    foreach (ParameterFieldDefinition parameterField in ReportDocument.DataDefinition.ParameterFields)
                    var query = ReportObjects.Values.Cast<Filters>().Where(objects => objects.ParameterName == parameterField.Name.ToUpper().Trim());
                    foreach (var item in query)
                        parameterField.CurrentValues.Clear();
                        parameterField.CurrentValues.Add(item.ParameterValue);
                        parameterField.ApplyMinMaxValues(item.MinLength, item.MaxLengh);
                        parameterField.ApplyCurrentValues(parameterField.CurrentValues);
                var records = ReportObjects.Values.Cast<Filters>().Where(recordSelection => recordSelection.RecordSelectionFormula.Trim().Length != 0);
                foreach (var item in records)
                    rsFormula += item.RecordSelectionFormula;
                if (rsFormula.EndsWith(" AND "))
                    rsFormula = rsFormula.RTrim(5);
                ReportDocument.RecordSelectionFormula = rsFormula;

    Hi,
    The report has it's own ADO Datasource set in crystal reports, so I just pass the log on information to the report object before doing anything else.
    this.DataSourceConnections[0].SetConnection("ServerName", "Database", "sa", "Password");
    I then do a refresh before applying the parameter values (I do this because the user can preview the report more than one time by using a preview button on the parameter form without re-loading the report object)
    this.Refresh();
    Then I set all parameter values followed by setting the recordselection formula.

  • Saving data in database using textbox and save button

    Hello. I just want a help about my code because when i close the application the data that i add is not been saved.
    Here is my code of save:
    function saveData(event:MouseEvent):void
      status.text = "Saving data";
      insertStmt = new SQLStatement();
      insertStmt.sqlConnection = conn;
      var sql:String = "INSERT INTO employees (firstName, lastName, salary) VALUES (:param, :param1, :param2)";
      insertStmt.text = sql;
      insertStmt.parameters[":param"] = firstName.text;
      insertStmt.parameters[":param1"] = lastName.text;
      insertStmt.parameters[":param2"] = salary.text;
      insertStmt.addEventListener(SQLEvent.RESULT, insertResult);
      insertStmt.addEventListener(SQLErrorEvent.ERROR, insertError);
      insertStmt.execute();
    Here is the full code:
    import fl.data.DataProvider;
    import flash.data.SQLResult;
    import flash.data.SQLConnection;
    import flash.filesystem.File;
    import flash.data.SQLStatement;
    import flash.data.SQLConnection;
    var conn:SQLConnection;
    var createStmt:SQLStatement;
    var insertStmt:SQLStatement;
    var insertStmt2:SQLStatement;
    var insertStmt3:SQLStatement;
    var selectStmt:SQLStatement;
    var insert1Complete:Boolean = false;
    var insert2Complete:Boolean = false;
    saveBtn.addEventListener(MouseEvent.CLICK, saveData);
    loadBtn.addEventListener(MouseEvent.CLICK, getData);
    init();
    function init():void
      conn = new SQLConnection();
      conn.addEventListener(SQLEvent.OPEN, openSuccess);
      conn.addEventListener(SQLErrorEvent.ERROR, openFailure);
      status.text = "Creating and opening database";
      // Use these two lines for an on-disk database
      // but be aware that the second time you run the app you'll get errors from
      // creating duplicate records.
    // var dbFile:File = File.applicationStorageDirectory.resolvePath("DBSample.db");
    // conn.openAsync(dbFile);
      // Use this line for an in-memory database
      conn.openAsync(null);
    function openSuccess(event:SQLEvent):void
      conn.removeEventListener(SQLEvent.OPEN, openSuccess);
      conn.removeEventListener(SQLErrorEvent.ERROR, openFailure);
      createTable();
    function openFailure(event:SQLErrorEvent):void
      conn.removeEventListener(SQLEvent.OPEN, openSuccess);
      conn.removeEventListener(SQLErrorEvent.ERROR, openFailure);
      status.text = "Error opening database";
      trace("event.error.message:", event.error.message);
      trace("event.error.details:", event.error.details);
    function createTable():void
      status.text = "Creating table";
      createStmt = new SQLStatement();
      createStmt.sqlConnection = conn;
      var sql:String = "";
      sql += "CREATE TABLE IF NOT EXISTS employees (";
      sql += " empId INTEGER PRIMARY KEY AUTOINCREMENT,";
      sql += " firstName TEXT,";
      sql += " lastName TEXT,";
      sql += " salary NUMERIC CHECK (salary >= 0) DEFAULT 0";
      sql += ")";
      createStmt.text = sql;
      createStmt.addEventListener(SQLEvent.RESULT, createResult);
      createStmt.addEventListener(SQLErrorEvent.ERROR, createError);
      createStmt.execute();
    function createResult(event:SQLEvent):void
      createStmt.removeEventListener(SQLEvent.RESULT, createResult);
      createStmt.removeEventListener(SQLErrorEvent.ERROR, createError);
      addData();
    function createError(event:SQLErrorEvent):void
      status.text = "Error creating table";
      createStmt.removeEventListener(SQLEvent.RESULT, createResult);
      createStmt.removeEventListener(SQLErrorEvent.ERROR, createError);
      trace("CREATE TABLE error:", event.error);
      trace("event.error.message:", event.error.message);
      trace("event.error.details:", event.error.details);
    function addData():void
      status.text = "Adding data to table";
      insertStmt = new SQLStatement();
      insertStmt.sqlConnection = conn;
      var sql:String = "";
      sql += "INSERT INTO employees (firstName, lastName, salary) ";
      sql += "VALUES ('Bob', 'Smith', 8000)";
      insertStmt.text = sql;
      insertStmt.addEventListener(SQLEvent.RESULT, insertResult);
      insertStmt.addEventListener(SQLErrorEvent.ERROR, insertError);
      insertStmt.execute();
      insertStmt2 = new SQLStatement();
      insertStmt2.sqlConnection = conn;
      var sql2:String = "";
      sql2 += "INSERT INTO employees (firstName, lastName, salary) ";
      sql2 += "VALUES ('John', 'Jones', 8200)";
      insertStmt2.text = sql2;
      insertStmt2.addEventListener(SQLEvent.RESULT, insertResult);
      insertStmt2.addEventListener(SQLErrorEvent.ERROR, insertError);
      insertStmt2.execute();
    function insertResult(event:SQLEvent):void
      var stmt:SQLStatement = event.target as SQLStatement;
      stmt.removeEventListener(SQLEvent.RESULT, insertResult);
      stmt.removeEventListener(SQLErrorEvent.ERROR, insertError);
      if (stmt == insertStmt)
      insert1Complete = true;
      else
      insert2Complete = true;
      if (insert1Complete && insert2Complete)
      status.text = "Ready to load data";
    function insertError(event:SQLErrorEvent):void
      status.text = "Error inserting data";
      insertStmt.removeEventListener(SQLEvent.RESULT, insertResult);
      insertStmt.removeEventListener(SQLErrorEvent.ERROR, insertError);
      trace("INSERT error:", event.error);
      trace("event.error.message:", event.error.message);
      trace("event.error.details:", event.error.details);
    function getData(event:MouseEvent):void
      status.text = "Loading data";
      selectStmt = new SQLStatement();
      selectStmt.sqlConnection = conn;
      var sql:String = "SELECT empId, firstName, lastName, salary FROM employees";
      selectStmt.text = sql;
      selectStmt.addEventListener(SQLEvent.RESULT, selectResult);
      selectStmt.addEventListener(SQLErrorEvent.ERROR, selectError);
      selectStmt.execute();
    function saveData(event:MouseEvent):void
      status.text = "Saving data";
      insertStmt = new SQLStatement();
      insertStmt.sqlConnection = conn;
      var sql:String = "INSERT INTO employees (firstName, lastName, salary) VALUES (:param, :param1, :param2)";
      insertStmt.text = sql;
      insertStmt.parameters[":param"] = firstName.text;
      insertStmt.parameters[":param1"] = lastName.text;
      insertStmt.parameters[":param2"] = salary.text;
      insertStmt.addEventListener(SQLEvent.RESULT, insertResult);
      insertStmt.addEventListener(SQLErrorEvent.ERROR, insertError);
      insertStmt.execute();
    function selectResult(event:SQLEvent):void
      status.text = "Data loaded";
      selectStmt.removeEventListener(SQLEvent.RESULT, selectResult);
      selectStmt.removeEventListener(SQLErrorEvent.ERROR, selectError);
      var result:SQLResult = selectStmt.getResult();
      resultsGrid.dataProvider = new DataProvider(result.data);
    // var numRows:int = result.data.length;
    // for (var i:int = 0; i < numRows; i++)
    // var output:String = "";
    // for (var prop:String in result.data[i])
    // output += prop + ": " + result.data[i][prop] + "; ";
    // trace("row[" + i.toString() + "]\t", output);
    function selectError(event:SQLErrorEvent):void
      status.text = "Error loading data";
      selectStmt.removeEventListener(SQLEvent.RESULT, selectResult);
      selectStmt.removeEventListener(SQLErrorEvent.ERROR, selectError);
      trace("SELECT error:", event.error);
      trace("event.error.message:", event.error.message);
      trace("event.error.details:", event.error.details);

    Your database system may well have a setting for character encoding when creating new databases. If you set that to unicode JDBC should store and retrieve UNICODE strings automatically.
    As to the HTML side, you should generally use UTF-8 encoding. You need an editor which understands UTF-8. JSPs and servlets have ways of specifying the encoding which goes into the http headers. For static HTML pages you may have to add a header like:
    <META http-equiv="Content-type" value="text/HTML; charset=UTF-8">
    When receiving form data you need to do
    request.setCharacterEncoding("UTF-8");

  • I have a question to ask you about General Data Selection in Report Painter

    Please help me out. Thi is the question....here it goes.
    In a Report in ReportPainter, I have in the General Data Selection the following selected characteristics. They are:
    Ledger = 0
    Record Type = 0
    Version =  1
    Fiscal Year = Z-ANOACT
    Period = (1CPERIV, 1CPERIB)
    So that we have the next screen in the Report’s execution.
    Fiscal Year : 2006
    From Period : 1
    To Period     : 12
    Note:
    *Z-ANOACT = Variable so that with a user-exit calculates the actual year. Right now is 2006.
    *1CPERIV = This From-Period Variable is referenced to CCSS Table and PERBL Field Name. Its default value is 1.
    *1CPERIB = This To-Period Variable is referenced to CCSS Table and PERBL Field Name.
    Its default value is 12. Rigth now, we are in the fiscal month 5 (November).
    Id like to filtrate information from January (2006) to September (2007). I mean I work with the fiscal calendar because the information to get from the table is saved due to this calendar.
    The Fiscal Calendar is from July to June:
    July = 1
    August = 2
    September = 3
    June = 12
    How I can accommodate my variables or what I am doing wrong so that I can select information from periods 7 to 12, 2006 ( January to June, 2006) and information from periods 1 to 3, 2007 (July to September, 2007) having the screen cited above and having the information selected added.
    I cannot do it with the criteria selection cited above because I only have a year and a range of periods and my end-user doesnt want to run my report twice:
    One run with periods 7 to 12, 2006 and
    Another run with periods 1 to 3, 2007
    Hed like something in my screen like this……
    Fiscal Year = 2006                                                
    From period = 7
    To Period     = 12
    Fiscal Year = 2007                                                
    From period = 1
    To Period     = 3
    And to get the report added.
    Many Thanks if you know anything that can help me, please let me know.

    ABDUL: I understand the ABAP Code but the information is saved in the table according to the fiscal calendar.
    Fiscal Calendar Number of the MonthYear
    January             7                    2006
    February            8                    2006
    March               9                    2006     
    April               10                    2006
    May                 11                    2006     
    June                12                    2006
    July                1                    2007
    Augost              2                    2007
    September           3                    2007
    October             4                    2007
    November            5                    2007     
    December            6                    2007
    Normally, We are in November 2006 (month=11, year 2006).
    However, fiscally; We are November 2007 (month=5, year=2007).
    Important Notes:
    •     The information is saved according to the fiscal calendar in the table.
    •     My end-user wants to filtrate the information from January to November . I mean
    Actual Year  : 2006               Actual Year   :  2007
    From   Period:      7     AND           From    Period:      1
    To       Period:     12               To        Period:       5
    I understand you told me about the ABAP code, for example my characteristics in the general data selection are:
    Actual Year  : 2006
    From   Period: 7
    To       Period: 5   (I would have an error here because From-Period Variable is greater than To-Period Variable)
    According the ABAP code you told me, this would be:
    Actual Year  : 2006
    From   Period: 1
    To       Period: 11
    If I run the report with these last parameters you told me, report painter only would add information from year 2006 and fiscal months 1 to 11 (July to May except June).  We don’t want this, that we want is :
    Actual Year  : 2006               Actual Year   :  2007
    From   Period:      7     AND           From    Period:      1
    To       Period:     12               To        Period:       5
    How can I do this?? My email is [email protected] or [email protected]
    Right now, the end-user runs the report twice and adds the information in excel. One run for :
    Actual Year  : 2006
    From   Period:      7
    To       Period:     12
    And other run with:
    Actual Year   :  2007
    From    Period:      1
    To        Period:       5
    But the question is how you can do it with only a run and in this way:
    Actual Year  : 2006               Actual Year   :  2007
    From   Period:      7     AND           From    Period:      1
    To       Period:     12               To        Period:       5
    Thanks if someone can help me!!

Maybe you are looking for

  • Getting a blank white index page in browser

    I have been working the tutorial on Creating your First Web Site by David Powers (Dreamwiver CC) that has worked flawless up to the end, where I tried adding the scripting code for older IE browsers. I downloaded the JS file aFarkas-html5shiv-67bff28

  • CS4 upgrade and Cloud licence

    Our company currently has 2 licences for CS4 and we are going to upgrade them both to CS6 (physical copies). Can we still use one of the serial numbers as validation to get the discount on an extra Creative Cloud licence?

  • Font in qt 4.5 cause eye-strain.

    Hello, I noticed that the font in QT applications look very different. They seem to ignore the hinting set in the GNOME Appearance utility. Here is a screenshot to compare the the two. Notice how the fonts in the QT4 application look very green/red.

  • Generalise business rule to fetch common inputs region wise

    Hi, Our entity dimension is changed to program(Which means projects) dimension which will include the location as a parent and under that are the list of programs specific to that location. our legal entity is a custom dimension. This change is done

  • Problem in unblock an object to modify.

    Hi people! I trying to edit an object and the system tell me that I need to go to the transaction SE03 and put it in modify option the namespace. How can I know the name space assigned to an object? Thanks!