Setting a Default Value in SQL Query Report

Hello:
We are using a SQL Query Report to provide a mass update to a table. We are using the apex.collection and having it display a number of records in a SQL Query Report for mass update. We have 14 columns in the report, for which the first 11 are populated via the collection. The remaining 3 are open for input but the individual making the updates. We've were able to provide a default value for 2 of the remaining 3 columns using a named LOV's - however the fourth column we would like to default a sysdate - but we are not successful.
We've attempted many things but none seem to work, including adding that column to the collection and assigning it a default sysdate value. We've also tried changing the settings in the report attributes --> Tabular Form Elements by setting the Display as to: Datepicker, Default type to PL/SQL Expression and setting the default to sysdate. We've also tried caputuring a date on the previous page and loading it onto the report page and trying to default the date column to a page item default.
I'd appreciate any help.
Thanks
FYI - we are using version 3.2

use as default
to_char(sysdate, 'dd/mm/yyy') where the format is your application or item date format

Similar Messages

  • Setting Default value with SQL Query as Data Model

    Hi All,
    I am developing report based on SQL query.date set as 'SQL Query'. I have created two params start-date and end-date. I am fetching records from database between these two dates.
    I want to populate sysdate as a default values. I do not want to use datatemplate approach i mean using beforeReport trigger.
    Thansk,
    Vara

    Hi Vara,
    To set the default value for one of your parameters to SYSDATE you need to enter:
    {$SYSDATE()$}
    in the Default Value text box
    Is this what you require?
    Cheers
    Andy

  • Setting a default value for SQL based LOV

    Hi There,
    Is there a way to set the default value in an LOV. Like lets say the LOV gets distinct to_Char(date_field,'YYYY') from a table. I want that the highest year is the default value. Currently, since I have the null option also, when the page loads, the lov is always null. I need to change it manually.
    Thanks,
    Sun

    You can easily set the dynamic item defaults
    http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21674/bldapp_item.htm#HTMDB28287
    for example select the default type as PL/SQL Function Body and enter the following code
    declare
    v_return date;
    begin
    select max(date_field) into v_return from your_table;
    return to_Char(v_return,'YYYY');
    exception when others then
    return null;
    end;

  • How-To populate SELECT LIST default value from SQL Query

    OK, I've done my homework, and did not find my answer in the Forum, so here it is.
    I have a Page that displays fields from a SQL Query. The Page also has below that radiogroups, checkboxes, and Select Lists to allow the user to change values in the fields that are displayed at the top of the Region. I am able to pre-populate the radiogroups and checkboxes by performing a SELECT in the 'Source value or expression' of the Source area of the Page Item.
    However, I am unable to do the same for the Select List fields. Their default value ends up being the first value in the LOV ('-- None --' for NULL values). Source Used: Only when current value in session state is null. Source Type: SQL Query. Also, when I first go into the Page when running it, and check the Session State values, they are all null, so I don't understand why the field is not populated by the SQL Query statement as the radiogroups and checkboxes are.
    Any suggestions??? I've tried all sorts of combinations.

    Thank you for the suggestion.
    I had considered that, but cannot do so, because we are using Oracle Application Express more for development than for data containment.
    We have all our data in an Oracle 10.g DB which is separate from the OAEX server, and the OAEX app will reference that data via VIEWs and DB LINKs. We are doing so primarily as an added data security layer, where the data is housed separate from the app, in case the Web site is ever compromised. The data that can be viewed is restricted to a subset of the actual data that is available.
    Since the data is on a separate server, (I assume) we will not be able to set the source type to Database column, because (I asume) that is dependent upon the data being housed by the OAEX server.
    That still leaves me with having to populate the field with a SELECT statement from the Oracle DB. This unfortuneately is almost a show-stopper for me because of down-stream processing data requirements. Have not been able to come up with contingencies yet.

  • Fill default value with SQL query or by an other way

    Hello everyone,
    I use Jdeveloper 11g and Weblogic.
    when I click on create button, I would like fill id_employee field automatically with the current user. I think there is a possibility in default value but I don't know how.
    My query is: SELECT Employee.ID_EMPLOYEE FROM Employee WHERE Employee.EMPLOYEE_NAME = :userName
    userName is a bind variable with this value: #{facesContext.externalContext.userPrincipal.name}
    If there is an other way I accept. Maybe with createwithparams, I tried but I didn't success.
    Please help me, I spent 2 weeks for this small problem.
    Thank you
    Regards

    Hi,
    if using ADF BC, you the create with params operation of the Viewobject to create a new row. On the created action binding, use the right mouse button to create a "NamedData" entry. Set the name of this entry to the name of the attribute you want to add teh default value to. In the NDValue field use EL to reference the authenticated user
    Frank
    Ps.: Your query is not a create statement, so I hope you are not confusing usecases here

  • Query to set item default value

    I'm trying to set a default value of an item by using a query. The first thing I tried is setting the source value to be:
    select 'TRDM-R-'||LPAD((MAX(SUBSTR(EXPAND_REQ_ID,8,3))+1),3,'0') EXPAND_REQ_ID FROM BANKSRG.TRDM_REQUIREMENTS;
    with item display type as Text, source type SQL Query. This displayed the value in the form, but did not save to the DB. (I tried all the other display types for text too)
    The next thing I tried (a suggestion for someone else in the forum) was set item display type is Display as Text (based on PL/SQL, does not save state), and the source type is PL/SQL Anonymous Block, with this query:
    for c1 in
    (select LPAD((MAX(SUBSTR(EXPAND_REQ_ID,8,3))+1),3,'0') EXPAND_REQ_ID
    FROM BANKSRG.TRDM_REQUIREMENTS)
    LOOP
    htp.p('TRDM-R-'||C1.EXPAND_REQ_ID);
    EXIT;
    END LOOP;
    but I get this error: Error ERR-9132 Error in PLSQL expression for item default code, item=P2_EXPAND_REQ_ID
    Then I tried the above query in the Default Value section, with the same error.
    I've also tried adding computations, but if i get the value to display, it still won't save to the DB.
    I would greatly appreciate any suggestions!
    Robin

    In case anyone else is new to HTMLDB and needs the answer to this question, I finally figured it out.
    In the Item the Display is Text Field, Source Used is Always..., Source Type Database Column, Source Value EXPAND_REQ_ID, Default Value &P2_EXPAND_REQ_ID., Default Value Type is Static Text...
    Then I created a Before Region computation, type sql Query, entered my query in the computation,
    select Condition Type Value of Item in Expression 1 is NULL, Expression 1 is P2_EXPAND_REQ_ID.
    Not so difficult, it just took a lot of time to try all the options.

  • BW Query variable default value put in Crystal report variable question

    Why BW Query variable default value put in Crystal report variable for BO InfoView to open crystal report.
    I using Analyzer to open bw query,variables had default value ,but crystal report can't had variable default value ,and can't search variable  value.
    pho:
    [http://file.itpub.net/f/e38876ad4f6efb7e73980488e7d71f8d/4ae940e9/day_091029/20091029_2b04da1232144feba180OrB23SNvXtoT.gif/p/1.gif]
    [http://file.itpub.net/f/d93ddfe61e0eaf80429726c61f1a02ff/4ae940e9/day_091029/20091029_3211ffe04bf0302fbab5FRKnbwmH80p7.gif/p/BW_QUERY_Crystal.gif]
    Edited by: flying on Oct 29, 2009 8:20 AM

    I Know what to do .
    but Crystal report date variable value are Garbage characters "###".
    PHO:
    [http://file.itpub.net/f/39a8510104476707ae21c945db93ecba/4ae97949/day_091029/20091029_32dcbb7e7d99141483aesJ9KBJHXN0Kj.gif/p/2.gif]

  • Setting up default value for POV in Financial Reporting Studio

    hello
    We need to Set up default value for POV in Financial Reporting Studio. For example, we need period to pick up Sep as default value when we run the report.
    Is there any way we could do this???
    Regards
    Neha

    Hi Neha,
    Yes, there is a way to setup of your grid POV. Take a look at this: http://download.oracle.com/docs/cd/E12825_01/epm.111/fr_user/127.html
    Cheers,
    Mehmet
    p.s. Please mark the answers helpful or correct, if they've helped you or answered your question. Thanks!

  • How to assign a default value on a Tabular Report?

    version 3.2.1
    I have a column in a Tabular Report (SQL Query (updateable report) ) that I would like to default to a value every time that the Add Rows button is clicked. This column needs to have the same value for every row.
    How do I set a default value on the column?
    Thanks,
    Joe

    I've run into the same problem. The 'Default' value isn't even appearing in the form, let alone getting stored.
    I'm not 100% certain (I'm still new to Apex too), but I think that the 'Default Type' and 'Default' value fields of the 'Tabular Form Element' might only apply to new records, ie when using the Tabular Form to create new records.
    In my case, I'm displaying existing records and I've been trying to enter a default new value for a particular field, ie change the value in the field for existing records from null to today's date. I couldn't get it to work and the more I think about it the more I realise that it is probably not the right way to do it.
    One alternative would be to put the SYSDATE into the source SQL (noting that changing an existing tabular form definition would cause an error, so I would have to create a new tabular form). But another (and I think preferable for me) option is to create a trigger that will put the SYSDATE into the field as each record is updated.
    Regards,
    Peter

  • BC4J,Setting a default Value In a View With Data From An Other View

    hi
    I'm developping A BC4J. I want to set the default value of a field By counting the number of rows in an other view.
    So I want to instanciate the view and execute the sql statement and get the result.
    Is that the right manner to do it or not.
    can someone help me to do that
    cheers
    ghassen

    There's lots of ways to skin this cat depending upon whether you mean "database view" or "view object" when you say "view", and individual requirements.
    Given database views v1 and v2 with a common key between them
    select v1.x, count(*) from v1,v2 where v1.key = v2.key group by v1.x;
    either in the database view or in expert mode for the view object ( I think it'll take group by, but never done it ). ( assumption is that v1.x is a primary key for v1 )...
    Try this from sql*Plus first to get a feel for how this works.
    The catch with the above is that it is "static"... if you can ADD rows to v2 in your application... they aren't visible in the count until saved and requeried.
    Another way ( I think... hopefully Oracle folk will kibitz... )
    Create your own attribute on the view object like "TheOtherCount".
    In the view object's RowImpl, find the "getTheOtherCount". Find the count of rows in the second view object or entity object or rowSetInfo through the method of your choice. ( If you've already set up a master detail relationship that is active you can just get the rowcount! ). Refer to earlier postings on how to get the rowcount, or to create a dynamic view query to get the count.
    The nice thing is that this should reflect your counts even if the second view has added or removed rows... but will probably move like a snail.
    Note that if you have a need where you want the row count updated in a frame for v1 whenever v2 is added to or removed from... well... then you need to set up some sort of event listener to do a redisplay of v1's frame, I'd think? Since the attribute you've created in the view object is not based on an entity object attribute, it has no way to know when it has been "updated" via an additional or removed row from the target.
    I'm posting the above because no one has responded yet... it may form a place to start from. And maybe someone in the know will go "No, No, No... KKirk... it doesn't work that way at all!" and fill us in on how this can be accomplished!
    Good Luck

  • Apex - SQL query report.

    Hi,
    Apex - 4.0 and Oracle -11g
    I m having a SQL Query report.
    Query
    SELECT htmldb_item.hidden(1,id) id,
      htmldb_item.select_list_from_query_xl(2,name,'SELECT name ,                                                              
    deptid                                                     
    FROM  emp                                                     
    WHERE name like ''E%''') name,
      htmldb_item.select_list_from_query_xl(3,deptname,'SELECT  deptname from dept where deptid =   ???') deptname
    FROM tabel
    My problem, in the report when the Select list for 'name' has been choosen , then it should retrieve the deptname based on the 'name'.
    Is it possible ?

    you want  select list value should affected in SQL report? i mean redirect and set value to SQL report?

  • SQL Query report region that only queries on first load

    Hello all,
    Is there any way in which you can prevent a SQL Query report region from quering data after every refresh?
    I would like to make a report that queries on the first load, but then I would like to change the individual values, and reload to show the change, but every time I reload the page the columns are queried and the original values are displayed once again...
    any ideas?
    -Mux

    Chet,
    I created a header process to create the HTMLDB_COLLECTION. It is something like:
    HTMLDB_COLLECTION.CREATE_COLLECTION_FROM_QUERY(
    p_collection_name => 'Course_Data',
    p_query => 'SELECT DISTINCT COURSE_ID, HTMLDB_ITEM.CHECKBOX(14,COURSE_ID) as "checker", TITLE, SUBJECT, COURSE_NUMB, SECTION, ENROLLED, null as "temp_term", null as "temp_title", null as "temp_crse_id", null as "temp_subj", null as "temp_crse_numb", null as "temp_sect", FROM DB_TBL_A, DB_TBL_B, DB_TBL_C, DB_TBL_D, DB_TBL_E, DB_TBL_F WHERE ...');
    The names were changed, for obvious reasons.
    I then created an SQL Report Region to see if it would work. The SQL is:
    SELECT c001, c002, c003
    FROM htmldb_collections
    WHERE collection_name = 'COURSE_DATA'
    When I run the page it says:
    ORA-20104: create_collection_from_query Error:ORA-20104: create_collection_from_query ExecErr:ORA-01008: not all variables bound
    Any idea why this is happening?
    I'm new to HTMLDB_COLLECTIONS, so I may be doing something wrong
    -Mux

  • How to set a default value to a field in *_BrowEdit.jsp?

    I know that we can use:
    <jbo:AttributeIterate id="def" datasource="<%=dsName%>">
    <jbo:RenderValue datasource="<%=dsName%>"/><br>
    </jbo:AttributeIterate>
    to accept value .
    And now ,I want to set a default value to a filed.
    How to do?

    Hi,
    This functionality is known to be very important and is a key part of the next major release of the JRC planned for the first half of 2008.
    Regards,
    <p>Blair Wheadon</p>
    <p>Product Manager, Crystal Reports</p>

  • User defined function to set a default value of a column

    Hi All
    Can we use user defined function to set a default value of a column ??
    for example:
    create or replace  function test1  return number is
    begin
    return 10;
    end;
    create table testt
    (id  as test1,
      name varchar2(20));
    error:
    ORA-02000: missing ( keywordThanks
    Ashwani

    174313 wrote:
    MichaelS for showing example to use function in table ddl , otherwise i was thinking we cannot use function in table ddl as per error I received.That was an example of a virtual column.
    ORA-04044: procedure, function, package, or type is not allowed hereUsing PL/SQL code like that raises 2 basic problems. If that PL/SQL code for the calculating the column default breaks, what happens to the SQL insert statements against that table. These will need to fail as the table definition depends on the PL/SQL code. This is problematic as this dependency simply increases the complexity of the SQL object.
    The 2nd issue is performance. PL/SQL code needs to be executed by the PL/SQL engine. This means a context switch from the SQL engine to the PL/SQL engine in order to determine the default value for that column. Context switching is a performance overhead.
    So even if it was possible to use a PL/SQL function as parameter for the SQL default clause, I would not be that keen to use it.

  • SQL Query Report Very slow

    Hi I have a sql query report that is taking very long to render.The query on sql developer comes back in less than a second.Any ideas on what could be wrong?

    Hi
    When posting code on the forum, put {noformat}{noformat} (with the curly brackets and the word code in lowercase) above and below your code like this...
    {noformat}{noformat}
    SELECT *
    FROM emp
    {noformat}{noformat}
    It will then appear like this, preserving formatting...SELECT *
    FROM emp
    Next, how many rows are returned in total, it may be that you have SQL Developer set up to fetch only the first x number of rows?
    Why have you put a CHOOSE hint in there?
    Is it a classic report or an interactive report?
    It looks like you're going over a database link, you really need to provide an explain plan (formatted as I have detailed above), a DRIVING_SITE hint may help you but it's impossible to know without seeing the plan...
    Cheers
    Ben                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Maybe you are looking for

  • Data recovery question / challenge...

    Please email me if you have any advice: [email protected] / challenge:Is there a tool by hyperion or anyone else, that will recover data from a valid index file & page file? As an administrator you can only export cubes through the server process, wh

  • To improve data load performance

    Hi, The data is getting loaded into the cube. Here there are no routines in update rules and transfer rules. Direct mapping is done to the infoobjects. But there is an ABAP routine written for 0CALDAY in the infopackage . Other than the below code ,

  • Select stmt offset - how can I use select stmt to fetch data.

    kna1-name2 contains store#XXXXXXX where XXXXXXX is a store number.  example : store#3564261. I must fetch this.  how can i fetch this ? Can I use WHERE substr(name2,7,10) CS gt_soldto1-store_no or can I use WHERE name2+7(10) CS gt_soldto1-store_no al

  • Best way to Lock a Table in exclusive mode ?

    Hi I have a procedure that update a record in a table. This table is accessed for many work stations and these stations update this table several times. In average this table is updated 900,000 times a day. My oracle version is 9.02 In this table the

  • Create Relation Type ContactPartner with own Relationtype

    Hi everybody, i copied the relationtype BUR001 (Contact Partner) into the Type ZUR001. Now when I create a new Contact Partner with a new bol-Object  lv_fac =  lv_core->get_entity_factory( 'BuilContactPerson' ). lr_builcontactperson = lv_fac->create(