How to assign a default value to a query variable

If I create a query, and it contains a variable that I want the user to input, can I also assign a default to that variable which the user will see when they run the query? If they make no selection it would use the default instead of the user input?
Thanks

Hello Peter - One way might be by using the "CASE" function inside the SQL.
It might be good for you to post your curent SQL here in the forum and a bit more explanation of what you are looking for.  That way folks can review and provide suggestions on how to accomplish on how it can be done...
Zal

Similar Messages

  • How to assign a default value to a SelectOneChoice

    Hi,
    I'm working with ADF 11g: WebLogic 10.3 and JDeveloper 11.1.1.3.0.
    I wonder how to assign a default value to a SelectOneChoice.
    In a ViewObject I have a field defined as Combo Box. Then drawing the combo in my jspx page:
    +<af:selectOneChoice value="#{bindings.Circularidad.inputValue}"+
    +label="#{bindings.Circularidad.label}:"+
    +required="#{bindings.Circularidad.hints.mandatory}"+
    +shortDesc="#{bindings.Circularidad.hints.tooltip}"+
    +id="soc2">+
    +<f:selectItems value="#{bindings.Circularidad.items}"+
    +id="si2"/>+
    +</af:selectOneChoice>+
    Can anyone help me?
    Thanks.

    Assume u have an LOV relation associated with VO attribute.
    1. Go to Edit List of Values window
    2. Click UI Hints tab
    3. Check Include no selection item check box.
    4. Select Labeled Item ( First of the list) entry form right combo box.
    5. Give ur default value in right text box.
    Regards,
    Dinil Mithra

  • How to assign a default value when there is no prompted value

    Dear all,
    I create a filter and it's value is relate to a prompt.If the prompt is not fill I found that all record is selected.
    How did I assign a default value so that when I didn't fill some value in to the prompt and still can get the result by
    the default value I set?
    Thanks a lot!

    Are you using dates for between or some character column?
    Post your example.
    Instead of between use to is equal prompts, so u will have then 2 fields one for date from a nd one for date to. Everything is the same as I wrote just repeat steps...
    You must put 2 separate fields if you are using date between and you want to have default variable for both.
    Column formula for the first calendar date prompt:
    case when 1=2 then TIMES.TIME_ID else cast ('1.1.1900' as date) end
    and for the second:
    case when 1=2 then TIMES.TIME_ID else cast ('1.1.2900' as date) end
    Now you set up default repository variable for both prompts.
    Presentation variable you put in the set presentation variable on each prompt:
    p_date_from
    p_date_to
    And in Answers filter will be like this:
    *TIMES.TIME_ID between @{p_date_from}{VALUEOF("rv_test_date_to_char")} and @{p_date_to}{VALUEOF("rv_test_date_to_char")}*
    or you can put a different default variables
    *TIMES.TIME_ID between @{p_date_from}{VALUEOF("rv_test_date_to_char_from")} and @{p_date_to}{VALUEOF("rv_test_date_to_char_to")}*
    I posted similar in my blog:
    Date between in filter and title when using presentation variable from calendar dashboard prompt or drop-down list in OBIEE
    http://108obiee.blogspot.com/2009/03/date-between-in-filter-and-title-when.html
    Regards,
    Goran O
    http://108obiee.blogspot.com
    Edited by: Goran O on 2009.04.23 03:37

  • How to assign the default value to search parameter

    Hi Experts,
    I am using search view , In this I have 5 parameter lets say Transaction Type, Partner No. etc... Now I want to assign a default value to transaction type ( lets say TA) . User should be able to see this default value in the transaction type field before pressing search button.
    How can I do it?
    My second problem is: I have configured this search view using configuration tool but I want to assign only one value to transaction type (i.e. user should not be able to add new row in the search criteria for the transaction type by using + sign)  but in rest 4 fields he can add new row and search based on that.
    Note: I am using only "Is" criteria .
    Any pointer will be helpful for me
    Thanks and regards,
    Sandeep

    Hi Sandeep,
    For the default search values, here is a solution. You have to redefine the method GET_VALUE1 of the context node
    For example if it is the BP search (component BP_HEAD_SEARCH) context node is your enhanced class: ZL_BP_HEAD__MAINSEARCH_CN00
    METHOD get_value1.
      CALL METHOD super->get_value1
        EXPORTING
          attribute_path = attribute_path
          iterator       = iterator
        RECEIVING
          value          = value.
      TRY.
    *     Delegate operation to selection parameter
          DATA: current TYPE REF TO if_bol_bo_property_access.
          IF iterator IS BOUND.
            current = iterator->get_current( ).
          ELSE.
            current = me->parameter_collection->get_current( ).
          ENDIF.
          IF current->get_property_as_string( iv_attr_name = 'ATTR_NAME' ) EQ 'XXX'.
            IF value IS INITIAL.
              value = 'Your default value'.
            ENDIF.
          ENDIF.
        CATCH cx_root.
      ENDTRY.
    ENDMETHOD.
    where XXX is the name of the field.
    Default value will then appear in your search field, but you are still able to modify it if you want...
    Regards,
    Fabian

  • How to assign a default value to a column ?

    Hi
    In the Object browser is it possible to modifiy a column in order to assign a defalut value to the column ?
    I have a table FICHE in which I want to assign a default value 0 to a column which type is NUMBER.
    Thank you for your kind answers.
    Christian.

    Hi Christian
    For one reason or the other you can't do that using 'Create Column' or 'Modify Column'. You can only do that by issuing a SQL command : alter table fiche modify column( <column name> default 0)
    HTH
    Roel

  • How to Assign a default value and Increement in my Target table ........?

    Hi,
    In my target table I want to Increment a value and store it in the table ........
    the increement shud start frm ...........5001,5002,5003..................etc
    How can I achieve this...........?
    I created an numeric Variable and in assigned the default as 5000 nad action as Historize.........
    In the target Datastore ......I assigned VAR+1.......
    but in the Target column I got 5001 for all the columns........
    Which way is the best way to deal with the Variables.......
    Thanks
    AK
    Message was edited by:
    AK2008

    Hi Gurusank and Micropole,
    Thanks for reply and info.....
    I am trying out one of the solutions first........
    Gurusank,
    I have created a sequence........whether I need to mention the schema and table name ,column.........also ( I gave all the information) and Increement column =1 and saved it .......
    Then I follwed the procedure as u have mentioned .....
    And in the Target field also I gave the same the same.......for tat column I gave choose (target for execution).
    And I directly ran the interface ..........
    I got the folowing Error:
    287 : 42000 : java.sql.SQLException: ORA-02287: sequence number not allowed here
    java.sql.SQLException: ORA-02287: sequence number not allowed here
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:282)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:639)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:185)
         at oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatement.java:633)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1086)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2984)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3057)
         at com.sunopsis.sql.SnpsQuery.executeUpdate(SnpsQuery.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execStdOrders(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSqlI.treatTaskTrt(SnpSessTaskSqlI.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
         at com.sunopsis.dwg.cmd.e.i(e.java)
         at com.sunopsis.dwg.cmd.g.y(g.java)
         at com.sunopsis.dwg.cmd.e.run(e.java)
         at java.lang.Thread.run(Thread.java:534)
    Could u plz let me know where I am doing the mistake
    Thanks
    AK

  • 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

  • Assigning a default value to a field

    Hello Everyone,
           Could you please tell me how to assign a default value to a field in a transparent table, so that while creating an entry even if we don't enter the value, a default value will be assigned.
    Thanks,
    Anbu.

    Like this
    DATA: BEGIN OF itab OCCURS 0,
            field1 TYPE c VALUE 'X'
            field2 TYPE c,
          END OF itab.
    append itab.
    append itab.
    You will have by default X set in both rows for field1.
    Regards
    Marcin
    PS: Ooops I just noticed you meant transparent table but I wrote about internal one. As long as you maintain that table using maintenance view you can use event 05 - When Creating a New Entry and set fixed value for a field there. So whenever you create new entry it will receive that value.
    Edited by: Marcin Pciak on Jun 23, 2010 8:57 AM

  • A question about assigning a default value

    Hi guys, I have a question about assigning a default value to a Numeric Decision CO. This Co needs 2 parameters to compare with each other. I wanna assign para1 during runtime and para2 during design time, but I have no idea how to assign a default value to para2 during design time. Can anyone help me solve this question? Thx a lot.
    BTW I`m searching an article about Time-off example`s "details". I have read several articles about time-off example, but those are not detailed enough. I wanna know about all details of COs. Can anyone forward such article to me, plz.  Thx again.^^

    Hi,
    You can assign a default value to the parameter of a callable object.
    First attach your CO to an Action.At the action level you can assign default values to the CO Parameters.
    Select the action in the design time.
    Select the parameters tab for that action.
    Select the required paramter. At the top, you can find Default value tab, with that you can assign default value.
    I think you can achieve your requirements with Business logic CO better.
    [Business Logic CO|http://help.sap.com/saphelp_nwce10/helpdata/en/44/3d3936c5c14a8fe10000000a1553f6/content.htm]
    Thanks

  • Personalization and Default values in selection screen variables

    Hi everyone,
    I have certain questions regarding Front end part:-
    1)     Can we have multiple personalizations for a single user in Web templates; I know it is quite possible in BEx using Variants. Is there any such approach or any other solutions regarding it?
    2)     In our project we had a range selection screen customer exit variable on 0CALMONTH, which is showing a default value of 07.2007 to 09.2007, although we have removed the default values from the query variable and also checked the customer exits where it is used, but still it’s showing the value. We can’t delete and recreate the variable as such, as it is used in number of function module. Also these values are also transported to Quality system, where also it’s showing the same value.
    Did anyone face such a situation before?
    Eagerly waiting for a solution.....
    Thanks in advance

    Hi Chiran,
    Please try with following approach for multiple   personalizations for a single user in Web templates.
    While Defining Variable Choose the Option Copy personalization data from variable .
    The Features  of above approach is as follows.
    1)It will personalize variable values for Input Variables for each user.
    2)These values are saved for each variable as well as for user.
    3) At the time of defining variable it will allow us to enter one or more default values.All these values are appear in the variable screen when u execute the query or Web Application.
    So you can see the variable values in web also.Just try with this approach.
    May be it will resove u r issue some extent.
    Regarding u r Second Query Just try with Some tables, all the default values entries were saved in those tables. Delete default values from those entries.
    Thanks & Regards,
    Chandu.

  • How to assign list of default value for select-option variable???

    Hi every one
    This is Deepak,
    I want to know how to assign list of default value to select-option variable ? please any body tel me solution
    for example
    select-option matnr for mara-matnr default ..............and here i want to give more than 1 values that will be default value and use can choose any one at the time of input .
    Thank you in advance
    Deepak

    Hi.
    Check the following sample code.
    REPORT ztn_test.
    " It is example for list populating.
    TABLES:knvp.
    data: BEGIN OF itab OCCURS 10,
          kunnr like knvp-kunnr,
          END OF itab.
    data: wa_itab like itab.
    TYPE-POOLS: vrm.
    DATA: name TYPE vrm_id,
    list TYPE vrm_values,
    value LIKE LINE OF list.
    PARAMETERS: s_kunnr(20) type c  as LISTBOX VISIBLE LENGTH 40 .
    AT SELECTION-SCREEN OUTPUT.
    SELECT kunnr from knvp  into  CORRESPONDING FIELDS OF TABLE itab WHERE parvw = 'SP'. " SP for ur requirement
    " I have used loop to populate some values from table
    loop at itab into wa_itab.
      name = 'S_KUNNR'.
      value-key = sy-tabix.
      value-text = wa_itab-kunnr.
      append value to list.
      clear wa_itab.
    endloop.
    " If u want individaully assign the values change the code as
    name = 'S_KUNNR'." Select option name
      value-key = 1." Index
      value-text = 'VAL1'.
      append value to list.
    name = 'S_KUNNR'." Select option name
      value-key = 2." Index
      value-text = 'VAL2'.
      append value to list.
    CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING id = name
    values = list.
    Edited by: tahir naqqash on Feb 21, 2009 4:38 PM

  • Assigning a default value to a user property

    Hi everyone,
    do you know how can I assign a default value to a user property? It would be great if I should be able to assign it from the administration without writing any code (like profile web services...).
    Thank you!
    Alberto Marchiaro

    Hi Alberto,
    I don't think you can currently do this. In other words you can't set a default value for some object property and have it subbed in when no better value is available.
    You can however create a default profile, and set values for the object properties assigned to users (You do this by going to the "Default Profiles" manager). You can then edit the "Default Profile" that is already there (or create a new one), and edit the "Properties and Names". Set the value field to whatever you'd like to be copied by default.
    Once done, all new users that are created via a User Synchronization job will have this default profile. The changes will not apply to users that were previously created. If you created a new Default Profile in the Default Profiles Manager, then you need to goto the Authentication Source that you are doing your sync's from and pick which profile you'd like to use for All Groups. You can also create custom Default Profiles for various groups.
    Hope this helps,
    Akash

  • How to pass some default values in all elements which are blank in xslt.

    Hi,
    Help needed:
    Scenario:
    After .xslt transformation, there are some elements which are being mapped but left blank. I want to assign some default values to it like '0'. How to do that.
    Thanks.

    One solution would be something like this...
    http://remysharp.com/2008/08/15/how-to-default-a-variable-in-xslt/
    Or you can use a template like this...
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="node()|@*">
         <xsl:copy>
           <xsl:apply-templates select="node()|@*"/>
         </xsl:copy>
    </xsl:template>
    <xsl:template match="Title">
        <xsl:choose>
            <xsl:when test="string-length(normalize-space(.)) = 0">
                <Title>default</Title>
            </xsl:when>
            <xsl:otherwise>
                <xsl:copy-of select="."/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
    </xsl:stylesheet>For every empty "Title" node, this template will add <Title>default</Title>... If the Title has value it won't be changed... You can change this to your fields/your defaults... If you need default for other field just add another template in the same transformation...
    Cheers,
    Vlad

  • How to config the Default Values in IT 2006

    Dear Gurus,
                      My Client requirement is if i create Absence quota they want default quotas values
    eg PL= 40
         CL=7
         SL=5
    Then how to config the Default Values in IT 2006
    Other wise where i have to assign in Quotas limit
    Please advised
    Regards
    MHPO

    Configure ur Absence Quotas with Selection group and assign the value of that selection group in Quomo
    and run  RPTQTA00
    Time Data Personnel Time Management IMG   Managing Time Accounts Using Attendance/AbsenceRecording and Administration   Define Absence Quota Types. Time Quota Types Quotas
    PersonnelIMG   Managing Time Time Data Recording and Administration Time Management   Calculating Absence Entitlements Accounts Using Attendance/Absence Quotas   Permit Quota Generation Without TimeAutomatic Accrual of Absence Quotas  Evaluation.
    Time Time Evaluation  Personnel Time Management IMG   Set Personnel Subarea Groupings for Time Recording.Evaluation Settings
    PersIMG  Time Data Recording and Administration onnel Time Management   Calculating AbsenceManaging Time Accounts Using Attendance/Absence Quotas   Set Base Entitlements  Rules for Generating Absence Quotas Entitlements  Base Entitlement for Absence Quota Generation.
    Personnel TimeIMG   Managing Time Accounts Time Data Recording and Administration Management   Rules for Calculating Absence Entitlements Using Attendance/Absence Quotas   Determine Validity and Deduction Periods.Generating Absence Quotas
    IMG  Managing Time Data Recording and Administration  Personnel Time Management   Calculating Absence EntitlementsTime Accounts Using Attendance/Absence Quotas   Define Set Base Entitlements  Rules for Generating Absence Quotas  Generation Rules for Quota Selection.
    Define Public Holiday Work Schedules  Personnel Time Management IMG  Classes
    Personnel Work Schedules  Personnel Time Management IMG   Group Personnel Subareas for the Work ScheduleSubarea Groupings
    IMG   Group Personnel Subarea Groupings  Work Schedules Personnel Time Management  Personnel Subareas for theDaily Work Schedule
     Daily Work Schedules  Work Schedules  Personnel Time Management IMG  Define Daily Work Schedules
    Work Personnel Time Management IMG   Define Period Work Schedules. Period Work Schedules Schedules
    IMG   Define Day Day Types  Work Schedules Personnel Time Management  Types.
     Day Types  Work Schedules  Personnel Time Management IMG  Define Day Types.
    Day Work Schedules  Personnel Time Management IMG   Define Special Days.Types
    Work Personnel Time Management IMG   Define Employee Subgroup Work Schedule Rules and Work Schedules Schedules  Groupings
    Work Work Schedules  Personnel Time Management IMG   Define Groupings for the Public HolidaySchedule Rules and Work Schedules  Calendar.
    Work Work Schedules  Personnel Time Management IMG   Set Work Schedule Rules and WorkSchedule Rules and Work Schedules  Schedules.
    Work Work Schedules  Personnel Time Management IMG   Generate Work Schedules ManuallySchedule Rules and Work Schedules
    IMG  Set Planned Working Time  Work Schedules  Personnel Time Management  Default Value for the Work Schedule.
     Personnel Time Management IMG   Set Default Value for Time Management Planned Working Time Work Schedules  Status.
    Time Data Recording and Personnel Time Management IMG   Define Personnel Subareas for Substitution Substitutions Administration  Types.
    Time Data Recording and Personnel Time Management IMG   Set Defaults for Substitution Types. Substitutions Administration
    IMG  Absences Time Data Recording and Administration  Personnel Time Management   Group Personnel Subareas for Attendances and Absence Catalog  Absences.
    Time Data Recording and Personnel Time Management IMG   Define Absence Types. Absence Catalog  Absences Administration
    IMG   Absences  Time Data Recording and Administration Personnel Time Management   Define Counting Classes for the Period Work Absence Counting Absence Catalog  Schedule.
    Time Data Recording and Personnel Time Management IMG   Rules for Absence Counting  Absence Catalog  Absences Administration   Group Employee Subgroups for Time Quotas.Absence Counting (New)
    IMG   Absences  Time Data Recording and Administration Personnel Time Management   Group Rules for Absence Counting (New)  Absence Counting Absence Catalog  Personnel Subareas for Time Quotas
    Time Personnel Time Management IMG   Absence Absence Catalog  Absences Data Recording and Administration   Define Rules for Rounding Counted Rules for Absence Counting (New) Counting  Absences
    Time Data Recording and Personnel Time Management IMG   Rules for Absence Counting  Absence Catalog  Absences Administration   Define Counting RulesAbsence Counting (New)
    Personnel TimeIMG   Absence Catalog Absences  Time Data Recording and Administration Management   Define Counting Rules  Rules for Absence Counting (New)  Absence Counting  Deduction rules for Absence quotas
    Time Personnel Time Management IMG   Absence Absence Catalog  Absences Data Recording and Administration   Assign Counting Rules to Absence Types.Counting
    Personnel TimeIMG   Attendances/Actual Working Time Data Recording and Administration Management   Define Attendance Types.Times
    Time Personnel Time Management IMG   Attendances/Actual Working Times Data Recording and Administration   Assign Counting Rules for Attendance counting (New) Attendance counting  Rules to Attendance Types.
    Time Data Personnel Time Management IMG   Managing Time Accounts Using Attendance/AbsenceRecording and Administration   Define Absence Quota Types. Time Quota Types Quotas
    PersonnelIMG   Managing Time Time Data Recording and Administration Time Management   Calculating Absence Entitlements Accounts Using Attendance/Absence Quotas   Permit Quota Generation Without TimeAutomatic Accrual of Absence Quotas  Evaluation.
    Time Time Evaluation  Personnel Time Management IMG   Set Personnel Subarea Groupings for Time Recording.Evaluation Settings
     Time Data Recording and Administration  Personnel Time Management IMG  Managing  Calculating AbsenceTime Accounts Using Attendance/Absence Quotas   Set Base Entitlements  Rules for Generating Absence Quotas Entitlements  Base Entitlement for Absence Quota Generation.
    Personnel TimeIMG   Managing Time Accounts Time Data Recording and Administration Management   Rules for Calculating Absence Entitlements Using Attendance/Absence Quotas   Determine Validity and Deduction Periods.Generating Absence Quotas
    IMG  Managing Time Data Recording and Administration  Personnel Time Management   Calculating Absence EntitlementsTime Accounts Using Attendance/Absence Quotas   Define Set Base Entitlements  Rules for Generating Absence Quotas  Generation Rules for Quota Selection.

  • How to Change a Default Value from Drop Down Box displayed in Web Dynpro?

    Hi,
    How to Change a Default Value from 'High' to 'Low'  in a Drop Down Box for RANGE field displayed in Standard Web Dynpro Component.  I saw a Default Value set for a RANGE field  in View Context When I select that field and click on Display. I am seeing Default Value set it to 'HI'. Please let me know how to change from HIgh to Low.
    I appreciate your help!
    Thanks,
    Monica

    hi,
    use the set_attribute( ) method now to set the attribute with a particular key eg HIGH in ur case
    // u can use the code wizard( control +f7) this code will be auto generated when u select the
    //radio button to read the context node
    DATA lo_nd_cn_node TYPE REF TO if_wd_context_node.
      DATA lo_el_cn_node TYPE REF TO if_wd_context_element.
      DATA ls_cn_node TYPE wd_this->element_cn_node.
    * navigate from <CONTEXT> to <CN_NODE> via lead selection
      lo_nd_cn_node = wd_context->get_child_node( name = wd_this->wdctx_cn_node ).
    * get element via lead selection
      lo_el_cn_node = lo_nd_cn_node->get_element(  ).
    * set single attribute
      lo_el_cn_node->set_attribute(
          name =  `ATTribute name.`
          value = 'LOW' ).
    it will solve ur query ..
    also refer to this component
    wdr_test_events -> view dropdownbyidx and dropdownbykey ->method name onactionselect.
    regards,
    amit

Maybe you are looking for