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

Similar Messages

  • 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

  • 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

  • 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.

  • Setting default values with stored procedures

    I have a form that has Start Date and End Date text fields
    that I want to use to colect parameters to send to another page.
    How do I make these default to the first and last day of the
    current year? I know how to use the DATEADD and DATEDIFF functions
    to get the dates but when the value gets to the page it is 0. My
    data is stored in an SQL server.
    CREATE PROCEDURE [dbo].[sp_FirstDayOfCurrentYear] AS
    SELECT DATEADD(yy, DATEDIFF(yy,0,GETDATE()),0)
    GO
    When I run the in the SQL Query Analyzer it returns
    2006-01-01 00:00:00.000
    The command on the asp page is
    Type = Stored Procedure
    SQL = dbo.sp_FirstDayOfCurrentYear
    Variables: Name = @RETURN_VALUE Type = Integer Direction =
    RETURN_VALUE The remainder are blank.

    You'll need to edit the DW-generated code so your parameter
    is Empty instead
    of whatever default DW assigns (usually "" if you leave
    default blank).
    "mtsonic1971" <[email protected]> wrote in
    message
    news:e7rj9j$132$[email protected]..
    >I have a form that has Start Date and End Date text
    fields that I want to
    >use
    > to colect parameters to send to another page. How do I
    make these default
    > to
    > the first and last day of the current year? I know how
    to use the DATEADD
    > and
    > DATEDIFF functions to get the dates but when the value
    gets to the page it
    > is
    > 0. My data is stored in an SQL server.
    >
    > CREATE PROCEDURE [dbo].[sp_FirstDayOfCurrentYear] AS
    >
    > SELECT DATEADD(yy, DATEDIFF(yy,0,GETDATE()),0)
    > GO
    >
    > When I run the in the SQL Query Analyzer it returns
    2006-01-01
    > 00:00:00.000
    >
    > The command on the asp page is
    > Type = Stored Procedure
    > SQL = dbo.sp_FirstDayOfCurrentYear
    > Variables: Name = @RETURN_VALUE Type = Integer Direction
    = RETURN_VALUE
    > The
    > remainder are blank.
    >

  • Set default value with mouse click?

    Hi guys,
    I'm new enough to LabVIEW, and indeed this forum, so I hope you can help. I'm guessing it's a simple problem, but I can't figure out how to do it.
    I've got a cRIO taking in 4 analog voltages. Each voltage is from a linear potentiometer which is measuring suspension displacment on a Formula Student race car.
    I have a simple formula set up to convert input voltage to displacment. I've set up a table of inputs which allows me to set maximum, minimum,(from previous sensor calibration) and "stationary" value of each sensor.
    The "stationary" value is what the sensor should be reading when the car is stopped. This is then used as a baseline for either positive or negative displacments.
    My problem is that each time a different driver gets in the car, the susspension is adjusted, or fuel is added, the "stationary" value will be different. I then have to manually set the stationary value back to whatever the current value is when the car is stopped, press "make current value default", and save the VI before continuing.
    What I would like, is a "calibrate" button which I can press that sets the "stationary" value to whatever the current input voltage is. This way, I wouldn't have to reset 4 values each time the car is modified.
    If you have any ideas on how to do this, please let me know.
    I'll attach my VI once I get back to the laptop where it is saved!
    Thanks,
    Kevin Irving
    Solved!
    Go to Solution.

    Kevin,
    As you have discovered you cannot change the default values on a running VI.
    The best way to do what you want is to use a configuration file.  There is a set of VIs specifically designed for that purpose on the File I/O palette.  When the user presses the "calibrate" button, the values are saved to the file. When the program starts it reads the file and sets the controls to the values in the file.  You can even keep different sets for each driver, if the data is consistent enough.
    Read the detailed help files for the configuration VIs and look at the examples.  These will show you how to get started.
    Lynn

  • How to set default values with parameter ID EVO

    Hi I need to set price adoption as ''do not copy'' in purchasing default values for buyer(OMFI) and need to assign this default value to the user using the EVO parameter.
    I can not see the parameter ID in dropdown list in maintain user screen.
    Can any one help me in this regard?
    Thank you,

    Just addition to Charlie's suggestion, make sure that you put the same value as used while creating parameter ID. if EVO key is created with Z1 and you put z1 then it wont work, you must put the same value Z1.
    Regards
    Arif Mansuri

  • Help with SQL Query and dates

    I am trying to return results between a year or 365 days. I need to run this at any time and return a year prior. I'm not getting any results? Any help? THX!
    SELECT
    NAME.ID,
    Activity.UF_2,
    Name.FIRST_NAME,
    Name.LAST_NAME,
    Name.EMAIL,
    Activity.TRANSACTION_DATE
    FROM
    Activity INNER
    JOIN Name
    ON Activity.ID
    = Name.ID
    Where
    activity.TRANSACTION_DATE
    BETWEEN
    CAST(CAST(DATEADD(DAY,
    -365,
    GETDATE())
    AS
    DATE)
    AS
    DATETIME)
    AND
    DATEADD
    (SECOND,
    -1,
    DATEADD(DAY,
    1,
    CAST(CAST(DATEADD(DAY,
    -365,
    GETDATE())
    AS
    DATE)
    AS
    DATETIME)))
    and Activity.UF_1
    =
    'a'
    and Activity.UF_2
    =
    'NAT'

    Where activity.TRANSACTION_DATE >= DATEADD(YEAR, -1, GETDATE()) AND activity.TRANSACTION_DATE < GETDATE()

  • Set default value based on sql query?

    Hi,
    is it possible to set default value of an BC entity attribute by using sql expression?
    Eg. "select max(x)+1 from y where userid=?"
    Rgs
    Jernej

    Jernej,
    Yes, you can do this. Edit your entity object attribute, and in the Edit Attribute dialog select "Derived from SQL Expression". Then you can enter your expression in the Expression text box.
    Blaise

  • Issue with SQL Query with Presentation Variable as Data Source in BI Publisher

    Hello All
    I have an issue with creating BIP report based on OBIEE reports which is done using direct SQL. There is this one report in OBIEE dashboard, which is written using direct SQL. To create the pixel perfect version of this report, I am creating BIP data model using SQL Query as data source. The physical query that is used to create OBIEE report has several presentation variables in its where clause.
    select TILE4,max(APPTS), 'Top Count' from
    SELECT c5 as division,nvl(DECODE (C2,0,0,(c1/c2)*100),0) AS APPTS,NTILE (4) OVER ( ORDER BY nvl(DECODE (C2,0,0,(c1/c2)*100),0))  AS TILE4,
    c4 as dept,c6 as month FROM 
    select sum(case  when T6736.TYPE = 'ATM' then T7608.COUNT end ) as c1,
         sum(case  when T6736.TYPE in ('Call Center', 'LSM') then T7608.CONFIRMED_COUNT end ) as c2,
         T802.NAME_LEVEL_6 as c3,
         T802.NAME_LEVEL_1 as c4,
         T6172.CALENDARMONTHNAMEANDYEAR as c5,
         T6172.CALENDARMONTHNUMBERINYEAR as c6,
         T802.DEPT_CODE as c7
    from
         DW_date_DIM T6736 /* z_dim_date */ ,
         DW_MONTH_DIM T6172 /* z_dim_month */ ,
         DW_GEOS_DIM T802 /* z_dim_dept_geo_hierarchy */ ,
         DW_Count_MONTH_AGG T7608 /* z_fact_Count_month_agg */
    where  ( T802.DEpt_CODE = T7608.DEPT_CODE and T802.NAME_LEVEL_1 =  '@{PV_D}{RSD}' 
    and T802.CALENDARMONTHNAMEANDYEAR = 'July 2013'
    and T6172.MONTH_KEY = T7608.MONTH_KEY and T6736.DATE_KEY = T7608.DATE_KEY
    and (T6172.CALENDARMONTHNUMBERINYEAR between substr('@{Month_Start}',0,6)  and substr('@{Month_END}',8,13))
    and (T6736.TYPE in ('Call Center', 'LSM')) )
    group by T802.DEPT_CODE, T802.NAME_LEVEL_6, T802.NAME_LEVEL_1, T6172.CALENDARMONTHNAMEANDYEAR, T6172.CALENDARMONTHNUMBERINYEAR
    order by c4, c3, c6, c7, c5
    ))where tile4=3 group by tile4
    When I try to view data after creating the data set, I get the following error:
    Failed to load XML
    XML Parsing Error: mismatched tag. Expected: . Location: http://172.20.17.142:9704/xmlpserver/servlet/xdo Line Number 2, Column 580:
    Now when I remove those Presention variables (@{PV1}, @{PV2}) in the query with some hard coded values, it is working fine.
    So I know it is the PV that's causing this error.
    How can I work around it?
    There is no way to create equivalent report without using the direct sql..
    Thanks in advance

    I have found a solution to this problem after some more investigation. PowerQuery does not support to use SQL statement as source for Teradata (possibly same for other sources as well). This is "by design" according to Microsoft. Hence the problem
    is not because different PowerQuery versions as mentioned above. When designing the query in PowerQuery in Excel make sure to use the interface/navigation to create the query/select tables and NOT a SQL statement. The SQL statement as source works fine on
    a client machine but not when scheduling it in Power BI in the cloud. I would like to see that the functionality within PowerQuery and Excel should be the same as in Power BI in the cloud. And at least when there is a difference it would be nice with documentation
    or more descriptive errors.
    //Jonas 

  • Setting default value read from user session, for an LOV in Query component

    I want to set the default value of a field in VO that participates in a named view criteria and thereby in Query component. That field is configured with an LOV by mean of a view accessor. The values are Y and N and the corresponding display strings obtained from view accessor are true and false respectively.
    I am able to set the default value by setting the value of the criteria item corresponding to that field in view criteria. I am setting the value as either Y or N and I am able to corresponding display string as per the view accessor, on the query component when it is rendered.
    I want to read the defauilt value from the ADF BC user session and set it as default value. I tried setting the values as "adf.userSession.userData.usageFlag". Iam ensuring that the attribute usageFlag is set before the view activity that has the query component is invoked. But this is ending up showing no default value in the Query component when rendered.
    Can any one let me know how to go about with this?

    I made up your table since you didn't provide some example, but I'm sure this will give you the picture:
    SQL> var run_type varchar2(1)
    SQL> exec :run_type := 'A'
    PL/SQL procedure successfully completed.
    SQL> create table my_cycles as select level cycle_id
      2                            ,      level cycle_status
      3                            from   dual connect by level <= 5;
    Table created.
    SQL> select cycle_id
      2  from   my_cycles
      3  where  case
      4           when :run_type = 'D' and cycle_status  = 1 then 1
      5           when :run_type != 'D' and cycle_status  in ( 2, 3 ) then 1
      6         end = 1;
      CYCLE_ID
             2
             3
    2 rows selected.
    SQL> exec :run_type := 'D';
    PL/SQL procedure successfully completed.
    SQL> /
      CYCLE_ID
             1
    1 row selected.
    SQL>

  • How to set the Default values for Info Objects in Data Selection of InfoPac

    Hi All,
    Flat file Extracion:
    How to set the Default values for Info Objects in Data Selection Tab  for Info Package
    ex: Fiscal Year Variant  Info Object having values 'K4' 'Y2' etc  in Flat file
    Initially  default value(not constant)  for this info Object value should be 'K4'  in Info Package
    If I set data selection value for this info object K4 it will retreive records with this selection only? how to handle
    Rgds,
    CV

    Hi,
    suppose as your ex. if you are having fiscalyear variant in the dataselection tab then specify K4 in the from column, again the ficalyearvariant row and click on insert duplicate row at the bottom . you will get another row . In that enter Y2 in the from column. now you can extract K4, y2 values .
    haritha

  • Set Default Values in Listbox with Dialog Programming

    Hi all,
    I am stuck with a problem i.e  I am working with Dialog Programming Screen
    where i have to set default values in some n numbers of Listbox which i have created on Screen.
    This default value is needed to be fetched from database table.
    I am using single table. Hence no confusion that i have to first fetch data from 1st listbox then corresponding data is fetched into second & so on ..NO NO This is not required.
    Simple one screen which will update a table in database, where  some fields on the screen needs to be default set as per tables domain default values set while table creation.
    Please help me out in this.
    Thanks & Regards,
    Sandhya.

    Please search SDN, before you post a new forum from next time... any ways just follow the below code..
    u need to use the FM 'VRM_SET_VALUES' to implement list box in module pool. Check the below code. u have to write this code in PBO..
    if c = 0.
    select land1 landx from t005t into table wi_country.
    sort wi_country by land1.
    delete adjacent duplicates from wi_country comparing all fields.
    loop at wi_country.
    wa_ctry-key = wi_country-land1.
    wa_ctry-text = wi_country-landx .
    append wa_ctry to wi_ctry.
    endloop.
    call function 'VRM_SET_VALUES'
    exporting
    id = 'ZCUST_MASTER1-COUNTRY'
    values = wi_ctry
    exceptions
    id_illegal_name = 1
    others = 2
    if sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    c = 1.
    endif.
    Hope this helps u,
    Regards,
    Rajesh

  • How to Set default value for taxonomywebtagging control with terms and nested terms

    Hi,
    I have created taxonomy control in custom aspx page and I am able to select terms but I am trying to setup default value to that control.
    Can anybody let me know how to set the default value for TaxonomyWebTagging control in custom.aspx page with nested terms?
    Any help would be greatly apprecited.
    Control code in aspx page:
    <td>
    <asp:Label runat="server" ID="lblLanguages">Field A: </asp:Label><asp:Label runat="server" ID="rfvlblLanguages" CssClass="errorMsg" ForeColor="Red">*</asp:Label>
    </td>
    <td>
    <Taxonomy:TaxonomyWebTaggingControl ID="term" Width="385px" runat="server" /></td>Mapping metedata code:TaxonomySession session = new TaxonomySession(SPContext.Current.Site);
    //Set the Business Unit Field
    SPSite site = SPContext.Current.Web.Site;
    TermStore termStore = session.TermStores["Managed Metadata Service"];
    Group group = termStore.Groups["GROUPName"];
    TermSet termSet = group.TermSets["TERMSETNAME"];
    Term term = termSet.Terms["TermA"];
    Guid termGuid = term.Id;
    term.SspId.Add(termStore.Id);
    term.TermSetId.Add(termSet.Id);
    term.AllowFillIn = true;
    term.AnchorId = countryGuid;
    term.IsMulti = true;
    Thank you.
    AA.

    Hi,
    According to your description, you want to set default value for TaxonomyWebTaggingControl.
    I have a test in my environment. It could be achieved by setting the Text Property of TaxonomyWebTaggingControl.
    Here is the code snippet:
    TaxonomySession session = new TaxonomySession(SPContext.Current.Site);
    SPSite site = SPContext.Current.Web.Site;
    TermStore termStore = session.TermStores["Managed Metadata Service"];
    Group group = termStore.Groups["GroupA"];
    TermSet termSet = group.TermSets["A"];
    Term term = termSet.Terms["A1"];
    TaxonomyWebTaggingControl1.SspId.Add(termStore.Id);
    TaxonomyWebTaggingControl1.SSPList = termStore.Id.ToString();
    TaxonomyWebTaggingControl1.TermSetId.Add(termSet.Id);
    TaxonomyWebTaggingControl1.TermSetList = termSet.Id.ToString();
    TaxonomyWebTaggingControl1.AllowFillIn = true;
    TaxonomyWebTaggingControl1.IsAddTerms = true;
    TaxonomyWebTaggingControl1.IsMulti = false;
    TaxonomyWebTaggingControl1.Text = string.Format("{0}|{1}", term.Name, term.Id.ToString());
    Here is a detailed article for your reference:
    http://blog.bugrapostaci.com/2010/09/23/taxonomywebtaggingcontrol-sharepoint/
    Feel free to Reply the test result.
    Thanks
    Patrick Liang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Patrick Liang
    TechNet Community Support

  • Setting default value for form field assoc with a table column

    On a "Create Record" situation I was trying to set the default values of some form fields using a page level "Process". These form fields have Source Type = Database Column. It wasn't working, I could only set non-db assoc form field values no matter when the "Process" was set to exec. From some other posts it seems that this is by design, ie. not being able to programatically set the initial values of form fields that are sourced to db columns. I was hoping to have just one "Process" that would exec to set these initial values in one place rather than scattered about for each field that needed a default value. These particular default values come from ref tables and may be different for each user.
    So, it looks like I have to use a "Default Value" plsql chunk for each field on the form itself or else set their value on the calling form's Redirect in the "Set these Items" area.
    Is this correct?

    You could define a database function which accepts the name of the item and the user ID of the user running the application. Based on the item name and the user ID have the function return the appropriate initial value. Invoke this function in a "Default Value" PL/SQL block.
    Does that help in centralizing your initial values? You could have one function per page or one function per application. I would do one function per application.

Maybe you are looking for