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

Similar Messages

  • Pass variable and set default value based on user's group

    Hello
    I'm using SharePoint 2010 and SQL 2012. I need to send a variable to the page and based on its value, set default value for a drop down list and send it to other web part to filter the data. Is it possible for certain users to send that value as a default
    and limit user to see only this value in the text field or drop down list; for others - to allow to see the drop down list, but also set the default value for that list?
    The main page was designed in SharePoint designer, using web parts (aspx page). I had setup a connection to Active Directory and already have the code to get user's groups and based on their group, I have that variable pulled into the web page for further
    use. But I don't know how to pass that value as a default value to the web part (currently using SharePoint Filter web part). When I tried to set a default value for the web part - it automatically puts the quotation marks around the name of the variable
    and shows it as a text instead of showing the value of the field.
    Thank you!
    P.s. I have limited knowledge of SharePoint and need guidance (links, examples, recommendations)!
    Alla Sanders

    Thank you for your response. I'll try to give you more details. On PageA I check user's groups and based on the group, assign the value and pass it to the next page (no input from the user, all done behind the scene and user is redirected to PageB).
    On the next page I read that value and would like to send it to the SharePoint List Filter Web as a default value, as well as send it to another web part that displays the list from SQL, filtered using that default value. Ideally, if the user is from Group
    A, I'd like for them to have only one value in that drop down list; if user is from Group B - give him drop down list with 40 items to choose from. Below there is a part of the code and variable fnum has the value from PageA (if I print the value on the screen
    - I do see that it has correct value, so the code that gets groups from Active directory works correctly). If I assign fnum as a default value of the list, it shows "fnum" instead of the value of variable fnum. I connect to SQL database, using external
    content - so the other list that I'm filtering based on the value in that drop down list - is XSLT Data View Web part. I also have 2 more filters on that page, that user will have full access to and based on their input, it is also sent to the XSLT web part
    to filter out more data. Since one of the filters is the date and I am filtering data starting from the date that user chooses - XSLT is the only web part that I was able to make it work with.
    I looked at the link you provided (thank you). It is using Content Query Web part. Will it work with external content, as well as accepting multiple filtering, including custom starting date? I appreciate your help!
    <%
    string fnum = Request.QueryString["field1"];
    %><table cellpadding="4" cellspacing="0" border="0" style="height: 1000px">
    <tr>
    <td id="_invisibleIfEmpty" name="_invisibleIfEmpty" colspan="2" valign="top" style="height: 101px">
    <WebPartPages:WebPartZone runat="server" Title="loc:Header" ID="Header" FrameType="TitleBarOnly"><ZoneTemplate>
    <WpNs0:SpListFilterWebPart runat="server" FilterMainControlWidthPixels="0" RequireSelection="False" ExportMode="All" PartImageLarge="/_layouts/images/wp_Filter.gif" AllowHide="False" ShowEmptyValue="True" MissingAssembly="Cannot import this Web Part." AllowClose="False" ID="g_1ccc4bca_3ba1_480b_b726_adfdb1e9e02d" IsIncludedFilter="" DetailLink="" AllowRemove="False" HelpMode="Modeless" AllowEdit="True" ValueFieldGuid="fa564e0f-0c70-4ab9-b863-0177e6ddd247" IsIncluded="True" Description="Filter the contents of web parts by using a list of values from a Office SharePoint Server list." FrameState="Normal" Dir="Default" AllowZoneChange="True" AllowMinimize="False" DefaultValue="fnum" Title="Facilities List Filter" PartOrder="2" ViewGuid="2da5d8db-6b55-4403-80a8-111e42049f8b" FrameType="None" CatalogIconImageUrl="/_layouts/images/wp_Filter.gif" FilterName="Facilities List Filter" HelpLink="" PartImageSmall="/_layouts/images/wp_Filter.gif" AllowConnect="True" DescriptionFieldGuid="2d97730a-cd0d-4cb9-8b55-424951201081" ConnectionID="00000000-0000-0000-0000-000000000000" ExportControlledProperties="True" TitleIconImageUrl="/_layouts/images/wp_Filter.gif" ChromeType="None" SuppressWebPartChrome="False" IsVisible="True" ListUrl="/Lists/FacilitiesList" AllowMultipleSelections="False" ZoneID="Header" __MarkupType="vsattributemarkup" __WebPartId="{768E2035-0461-4A09-8DDD-CA7020C2B23D}" WebPart="true" Height="" Width="615px"></WpNs0:SpListFilterWebPart>
    Alla Sanders

  • Set default value based on current day value and setItems in Design studio

    Hello
    I have 2 filters on my dashboard - year and month. The default display of the dashboard should populate current year data. Is it possible to create formula to populate dynamic default value based on the current date using setSelectedValue() ?
    Also, for the calendar month, the items are set as below
    DD_MONTH.setItems(DS_1.getMemberList("0CALMONTH",
    MemberPresentation.INTERNAL_KEY, MemberDisplay.TEXT, 12, "ALL");
    This displays month values as 01/2014, 02/2014 ... How can I change these value to display as January if mm = 01 and February if mm = 02 etc..
    Thanks
    Sirisha

    Hi Victor,
    I have tried using below statment to populate current year as the default selection value for the dropdown. Used it on Startup, but for some reason it loads all the data when the dashboard is opened the first time. Any ideas?
    DS_1.setFilter("0CALYEAR",[Convert.subString(APPLICATION.getInfo().dateNowInternalFormat, 4,6)]);
    Thanks
    Sirisha

  • Set Default Value based on Field from another table for a custom object

    I'm trying to set the default value on a custom object field to the value of an account field. I have tried the syntax 50 different ways, and just am getting no where. The account field label displays as DBA, the integration tag is ltDBA_ACCT, and it shows up in reporting fx area as Account.Text_22.
    The custom object field I'm triying to update is also called DBA, which was originally the "NAME" required field. Does the table name, Account, have to be included? Do I need a function in front of the field?
    I have been updating the external ID using the row ID with syntex <ID> (Less than ID greater than) so I know it is possible to set the Default Value, but <DBA>, <ltDBA_ACCT>, "Account"."DBA", and so on just don't not work.
    If anyone knows how to enter this I'd really appreciate the help.

    Ok, so if you want to default a field to the value from another object, you have to use the JoinFieldValue function. I think you understand that, based on your original post, but I want to be sure that you do.
    Next, this will only work as a default if the record is created from the object that you wish to join on because a default works at record creation and the ID needs to be available for it to work properly. It will not work if you choose the related object record after the custom object record is created. You could set the value as a post-default, but that does not seem to meet your requirements.
    The syntax for the Default Value would be as follows: JoinFieldValue(ref_record_type, foreign_key, field_name).
    In your case, ref_record_type is '<Account>', foreign_key is &#91;<AccountId>&#93;, and field_name is '<YourFieldName>'. The best way to determine what the field name is would be to create a new workflow for Account and use the Workflow Rule Condition expression builder to pick your field ("DBA") from the list. The value that is returned by the expression builder should be placed in the field_name variable in the JoinFieldValue function (minus the brackets and in single quotes).
    Give this a shot and let me know how you do.
    Thom

  • Setting default value using pl/sql

    I am having trouble writing the correct syntax for either a pl/sql expression or function on the default value section for a checkbox item. I share the same form for showing data in edit mode and creating new records. When the instance is a new record, I want an item called P12_ACTIVE to be set to Y (yes).
    I have tried several variations like:
    begin
    select distinct 'Y'
    into :P12_ACTIVE
    from VMS_PROSPECTING_ITEMS
    where order_id != :P12_ORDER_ID;
    end;
    -OR-
    declare defaultvalue varchar2(10);
    begin
    if not exists (select *
    from VMS_PROSPECTING_ITEMS
    where order_id = :P12_ORDER_ID) then
    defaultvalue := 'Y' ;
    end if;
    return defaultvalue ;
    end;
    -OR-
    as a pl/sql expression....
    select distinct 'Y'
    from VMS_PROSPECTING_ITEMS
    where order_id != :P12_ORDER_ID;
    end;
    Dawn

    This is my LOV definition for the item:
    STATIC: ;Y
    If I put Y as the default value, then the check box is always marked, even when the record is one that was edited; therefore potentially changing the active status incorrectly. I would like one of my examples to work right. My second example throws this error:
    Error ERR-9131 Error in PLSQL function body for item default code, item=P12_ACTIVE
    ORA-06550: line 3, column 8: PLS-00204: function or pseudo-column 'EXISTS' may be used inside a SQL statement only ORA-06550: line 3, column 1: PL/SQL: Statement ignored.

  • Setting default value based on Link

    I have a report with a link to a form. The link is a standard portal component link.
    The link passes in cus_id.
    I would like to set the default value of the form cus_id field to the cus_id value from the link when the form is presented in insert mode due to the expected situation where no record for the cus_id exists.
    I have tried using the following function in default value:
    NVL(portal30.wwpro_api_parameters.get_value('A_CUS_ID','LEVEL_TWO_FORM'),0)
    I have tried both CUS_ID and A_CUS_ID, but neither seems to return a value.
    Any suggestions are much appreciated!
    null

    I was able to reproduce this. The problem occurs because when referencing another page def (binding container) than the current one, this binding container needs to be "prepared" which is done by calling method refreshControl() on the binding container. For binding containers of parent groups, JHeadstart automatically prepares them as prat of the prepareModel phase of the current binding container. However, when clicking the AddRow button, this is too late, the default value expression is evakluated before the prepareModel phase.
    A simple work around is to manually add the value binding "masterField" and its iterator binding to the page definition of the detail group. You can then use the expression "#{bindings.masterfield.inputValue} and that should work.
    Note that in JHeadstart 10.1.3.3, we will add a "jhsPageDefs" managed bean that extends HashMap, which allows you to retrieve "prepared" binding containers. You can then use the expression
    #{jhsPageDefs['MasterWizardGroupPageDef'].masterfield.inputValue}
    Steven Davelaar,
    JHeadstart Team.

  • 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

  • Dynamic Rendering of Child Component based on SQL Query

    I want to preface this with I am very new to ADF.
    I have a page with a parent-multi child (tabbed) layout, and what I want to do is render one of the children based on the values of a sql query. I tried creating a manged bean but I had no idea how to get the database connection, so I added a method to my application module implementation instead. The method is of type boolean that runs my sql query and based on the results, returns true or false. I then set the tab's Rendered property to this method, #{bindings.method.execute}. Unfortunately, when I run the application the tab is not rendered, no matter what the value of the results. I therefore set a breakpoint on the code and ran it through the debugger, but the code is never being executed.
    If anyone could help, it would be greatly appreciated.
    I am running JDeveloper 11.1.1.3, hitting an Oracle 11g database, using ADF BC.
    Thanks,
    Michelle

    I don't really know what you mean, here is my code:
      public boolean checkLevel2Needed(String revwId)
        PreparedStatement stmnt = null;
        StringBuffer sql = new StringBuffer();
        Object[] procArgs = new Object[]{ revwId };
        ResultSet rs = null;
        boolean level2Required = false;
        System.out.println(revwId);
        sql.setLength(0);
        sql.append("Select count(*) as yesCount from usq.vu_review_response ");
        sql.append(" where revw_id = ? ");
        sql.append(" and gp_name = 'Level 1 Screen' ");
        sql.append(" and resp_text = 'Yes' ");
        try
          stmnt = getDBTransaction().createPreparedStatement(sql.toString(), 0);
          if (procArgs != null)
            for (int z = 0; z < procArgs.length; z++)
              stmnt.setObject(z + 1, procArgs[z]);
          rs = stmnt.executeQuery();
          if (rs.next())
            if (rs.getInt("yesCount")>0)
              System.out.println(rs.getInt("yesCount"));
              level2Required = true;
          rs.close();
        catch (SQLException e)
          throw new JboException(e);
        finally
          try
            if (stmnt != null)
              stmnt.close();
          catch (SQLException e) {}
        return level2Required;
      }But I don't think it is ever executing this code, the system.out.println's don't show up in the console and if I run it through the debugger with a breakpoint it never stops.
    What I really need is for this code to execute when I enter this page, and also any time the page is updated. Should I be using a backing bean?
    Thanks,
    Michelle
    Edited by: MSchaffer on Jan 6, 2011 5:27 PM

  • Set Default Value of Multi-select list item

    I have a multi-select list item I want to default the value of to '%' (which is really '%null%') and have it selected. I tried setting default value of item, but it doesn't take '%null%'. I also tried a computation with a static of
    :P507_ITEM := '%null%'; How do you get the default value set and selected?

    Hi
    Shijesh is right, you need to change your null return value and use that return value as your default. Try and use something of the same datatype as your real return values if you plan to use '%' to display all as it will make your queries simpler. eg.
    Company A returns 1
    Company B return 2
    % returns 0
    Then your query would be...
    SELECT ...
    FROM ...
    WHERE company_id = DECODE(:P_COMPANY,1,1,2,2,0,company_id)
    Hope this makes sense.
    Cheers
    Ben

  • Bold a single row in a Report based on SQL Query

    Should be easy? So, how do I bold a single row in a report based on SQL query without creating a new template or writing Java for the page? What is the Tabular Form Element "Element Attributes" field for? Or what am I supposed to put in there to make it do anything?

    One way to do this is to add a hidden column to your report which contains the formatting value, for example:
    select empno
    , ename
    , sal
    , decode(empno,1,'font-weight:bold','font-weight:normal') style
    from emp
    Hide the STYLE column.
    Then you can use this column for each column in Column Formatting > HTML expression in this way:
    <span style="#STYLE#">#SAL#</span>
    Unfortunately you have to do this for each colum you want to appear bold.
    good luck,
    Dirk Dral

  • How to set default value in transient boolean attribute in VO in ADF

    Hi ADF Experts,
    I have requirement like,I have viewObject with one transient booelan attribute,
    I want to set default value of that boolean attribute as "True"
    How can I achive that please help,
    Tried every thing but no luck.

    Hi,
    I am not sure what is the use of setting a default value for a transient attribute in a read-only VO.
    However, why not include that attribute with a default value in the query itself?
    Something like
    SELECT
         Empno, Ename, Deptno, 'true' as BooleanTransAttr
    FROM EMP
    and set the type of the attribute to Boolean?
    -Arun

  • Set default value for product type

    I want to set default value in product type drop  down box
    in component PRD01QR.
    view  SearchHelp.
    I tried with setter and getter , but not working
    they are using query string.

    Hi,
    You can achieve this by redefining the method GET_VH_PRODUCT_TYPE() in IMPL class of searchHelp view. Just copy paste the implementation of this method from super class and now control the internal table as per your requirement like
    comment out the line       APPEND INITIAL LINE TO lt_ddlb. (line no: 47)
    as it will add an empty line at the starting of internal of product type values which you dont want. In you case there should be some default value for product type field, so arrange the inetrnal table values according to you requirement and what ever value you want to default for product type that should be the first value in the drop down without empty line and add an empty line at the end of the internal table.
    No need to call super->GET_VH_PRODUCT_TYPE() in your implementation as you have written all the required code in your implemenation itself.
    Hope this would help you!
    Regards,
    Ajay

  • How to Set Default Value into a Tabular Form Element

    Hi,
    Hoping someone can assist with my Tabular Form query.
    I am using Oracle ApEx v3.0.1
    I was wondering how one can set a default value to one of my tabular form columns within Oracle ApEx v3.0.1 as I cannot see how to do it?
    Thanks.

    Hi Tony
    can you pl. help me how you resolve this? I have one tabular form and I am trying to set default value as :APP_USER, I type this in default value but somehow it is not displaying this value.
    thanks
    Dax

  • Setting Default Values in Search Criteria for COSTCENTER

    Hi ALL,
    I need Help for setting default values in search criteria for COST CENTER.
    Basically the issue is when creating a Shopping Cart, i need to assign a COST CENTER at Item level under COST ASSIGNMENT Tab.
    While searching the cost center i need to default the following fields in my search criteria based on the Login User :
    1. Controlling Area,
    2. Language Key.
    Please suggest some solution.
    Thanks & Best Regards,
    Surya

    Hi Vani,
    Sorry for the delay reply and Thanks a Lot for your timely support......I would like confirm once again is the name of the BADI is <b>bbp_f4_read_on_exit</b> or <b>bbp_f4_read_on_entry</b>. In this BADI i've not found a method to default Controlling Area. Can you please suggest me which method i can use.
    Thanks & Regards,
    Surya

  • Set default value in console.

    Hii all
    I have to set default value in console while running program .. let suppose application is needed username and password .. when it start .. firstly will display ��UserName: ADMIN.. and ADMIN would be editable � let suppose if user want to login with same username then would press enter ..otherwise will edit username with desired name �and so on� so my query is ......is it possible to make any field editable in run time ?? if ya plese give me some sample code..
    Thanks in advance..
    Vaibhav

    hello,
    please let me know ... how can I make my code editable .... give me some sample code... if possible
    Regards
    Vaibhav

Maybe you are looking for

  • Nokia Suite 3.8.30 Backup!!?

    How can i rescue the data inside Nokia Suite? I have to reset my win7, then erase all the contents in the Nokia Suite. I duplicated the Nokia Suite files in Program Files and Documents Files. Then i copy same location. But it didnt work. What am i su

  • Where in the portal do I set the scenario field

    I am using the MSS Lauch Pad (for ECC 6) but cannot find the iview and parameter to set "viewgroup" and "scenario". Could anyone give me details? Thanks Patrick

  • SOAP/WSDL and web-proxy

    Hi, I'd like to use WebServiceProxy.getServiceAt(URL) method with a web proxy. How can I give it the address of my proxy? Thanks, Miguel

  • No 2 way connection between printer and computer HELP HELP going nuts!!!

    On the hp website in downloads for hp officejet 6500 series for windows 7 is "additional information' for installing that particular printer for that windows 7, now under  "printer setup not complete" it says how to bypass the problem I have though t

  • Problems inserting flash movie into webpage

    I am trying to insert 2 different flash movies on one webpage One is a banner made in flash cs4 that works fine. The other is a movie that I encoded with flash cs4 from a m4v file. When i test this file using the flash player on my computer everythin