Assigning sequential value that resets to a group of records

Hello all, and happy FRIDAY!!!
I'm doing some data conversion for a new system and I'm having trouble coming up with a query.
Running Oracle 10.2
Sample Data:
create table test (GRP number, PART varchar2(20), SEQ number);
insert into test values(9000, 'lskdjf', null);
insert into test values(9000, 'alsdk', null);
insert into test values(9000, '492kjsfjsldk', null);
insert into test values(9000, 'lkjasdf0982j', null);
insert into test values(9001, 'likfjajsd', null);
insert into test values(9001, '234-092838', null);
insert into test values(8934, '000-192893aj', null);
insert into test values(8934, 'anotherpart', null);
insert into test values(8934, 'jjjj0-aa-2001', null);
insert into test values(8934, 'encifudy', null);
insert into test values(8934, 'asfdjslkjdfklsj', null);
insert into test values(8934, 'lksjdflj', null);
insert into test values(4736, 'l;ask---jdflasj', null);
commit;
Select * from test;Doing the select * at this point will give you the null data elements for the third column.
Problem:
I'm trying to run a query that spits out a sequence for each "group" of records. If there were 5 records in a group, I would want the sequence to start at 1 and go to 5... maybe ordered by part. (not quite sure the ordering, but need to do babysteps here) :P
Here is an example of the data output I'd want from the above example:
GRP     PART               SEQ
9000     lskdjf               1
9000     alsdk               2
9000     492kjsfjsldk          3
9000     lkjasdf0982j          4
9001     likfjajsd          1
9001     234-092838          2
8934     000-192893aj          1
8934     anotherpart          2
8934     jjjj0-aa-2001          3
8934     encifudy          4
8934     asfdjslkjdfklsj          5
8934     lksjdflj          6
4736     l;ask---jdflasj          1In that result, SEQ is not applied to the record in part order, but ultimately that might be something that I'd like to do. So far just working toward wanting to get those numbers in there. I have read using rankover(), but that is still a bit confusing to me on how that works. I'll go research it more as I suspect that is probably what I'm going to have to use.
Ultimately this is part of a cursor that is being fed through a bulk collect. I might be able to populate that SEQ in the PL/SQL, but I figured it'd be easier to just get them in place at the query level so they're already part of the collection, instead of having to build the logic to create that numbering system prior to insertion to a staging table.
Anyhoo... any help would be greatly appreciated! If I left anything out or am un-clear in anyway, please let me know! Thank you!
Edited by: dvsoukup on Jul 27, 2012 4:25 PM

Hi,
dvsoukup wrote:
Running Oracle 10.2
Sample Data:
create table test (GRP number, PART varchar2(20), SEQ number);
insert into test values(9000, 'lskdjf', null); ...
Thanks for posting your version, and the CREATE TABLE and INSERT statemen ts; that's very helpful!
>
Doing the select * at this point will give you the null data elements for the third column.
Problem:
I'm trying to run a query that spits out a sequence for each "group" of records. If there were 5 records in a group, I would want the sequence to start at 1 and go to 5... maybe ordered by part. (not quite sure the ordering, but need to do babysteps here) :P
I have read using rankover(), but that is still a bit confusing to me on how that works. You've got that right! Analytic functions are very strange looking and confusing at first. After a while, they don't seem so strange, and then they even get less confusing.
One thing to remember: "PARTITION BY x" (this clause is always optional) means that each value of x is a world unto itself. It's as if a separate query is being done for each value of x, and when they're all finished, the results are UNIONed together. In this case, you want to PARTITION BY grp.
I'll go research it more as I suspect that is probably what I'm going to have to use.You're very close; only, as the first reply said, it's not RANK that you want, but its close relative ROW_NUMBER. The difference between the two is how they handle ties. If you have duplicate data, RANK assigns duplicate numbers. I assume you want unique numbers, even if you have identical parts in the same grp.
Ultimately this is part of a cursor that is being fed through a bulk collect. I might be able to populate that SEQ in the PL/SQL, but I figured it'd be easier to just get them in place at the query level so they're already part of the collection, instead of having to build the logic to create that numbering system prior to insertion to a staging table.It's easy enough to assign the numbers when you build the table.
If the situation is what you posted, that is, your table already exists, but the seq number isn't populated yet, then you can do this:
MERGE INTO     test     dst
USING   (
         SELECT  grp
         ,         part
         ,         ROW_NUMBER () OVER ( PARTITION BY  grp
                                                ORDER BY      part
                           )       AS seq
         FROM    test
     )          src
ON     (     src.grp          = dst.grp
     AND     src.part     = dst.part
WHEN MATCHED THEN UPDATE
SET     dst.seq   = src.seq
;The MERGE statement above assumes that the combination (grp, part) is unique.
After you run it, this query:
SELECT       *
FROM       test
ORDER BY  grp
,            part
;will produce these results:
`      GRP PART                        SEQ
      4736 l;ask---jdflasj               1
      8934 000-192893aj                  1
      8934 anotherpart                   2
      8934 asfdjslkjdfklsj               3
      8934 encifudy                      4
      8934 jjjj0-aa-2001                 5
      8934 lksjdflj                      6
      9000 492kjsfjsldk                  1
      9000 alsdk                         2
      9000 lkjasdf0982j                  3
      9000 lskdjf                        4
      9001 234-092838                    1
      9001 likfjajsd                     2The USING clause above is almost the same as the query posted in the last message, but, in the analytic clause, instead of "ORDER BY grp, part" it only says "ORDER BY part". It never makes any sense to PARTITION BY and ORDER BY the same column in the same function. Why? Discuss.

Similar Messages

  • Assigning return value of a javascript function to a variable

    hi.
    I have a javascript function which returns string.
    I wanna assing return value of that function to variable.
    for example:
    <script>
    funtion writeMe()
    var ex;
    ex="try"
    return ex;
    </script>
    Then in body of JSP page. I wanna do something like:
    <% String st;%>
    Now I wanna assign the value that returned from writeMe function ("try") to st string.like:
    <%st= writeMe();%>. but of course it doesn't work. how can I do that?

    thnx. but actually what I want to do is sending some values produced by javascript to a barchart object. is it impossible too?
    I mean my script function returns something like "100, 200, 300". I wanna pass that values to barchart. when I want to add aplet tag to jsp code instead of writing:
    <param name="s1_value" value="100,200,300">
    I want to write somethin like:
    <param name="s1_value" value="myscriptfunction()">
    is it possible in JSP? I saw an example like this in asp. it was like:
    <param name="sampleLabels" value="<%call func1()>">. but in JSP it seems like call tag doesn't work. Is it possible in JSP?

  • Jsp:useBean and assigning a value to that bean

    Hello,
    I have a type called Country and I have declared a bean using the "jsp:useBean" syntax.
    I then try to assign a value to that bean in a scriptlet. Eventually I try to retrieve the values using "jsp:getProperty". The problem is that it appears to null.
    Here is the code of the jsp
    <%@ page language="java" %>
    <%@ page import="com.parispano.latinamericaguide.*" %>
    <%
    /* We retrieve the Countries object from the servlet context. */
    ServletContext sc = getServletContext();
    Countries cs = (Countries)sc.getAttribute("countries");
    %>
    <jsp:useBean id="country" class="com.parispano.latinamericaguide.Country"/>
    <%
    /* If the request contains a country id, then we set the variable. */
    country = cs.getCountryFromId(Integer.parseInt(request.getParameter("countryID")));
    %>
    <html>
    <head>
    <title>Country details</title>
    </head>
    <body>
    <table>
    <tr><td>Name</td><td><jsp:getProperty name="country" property="name"/><!-- This is not working--></td></tr>
    <table>
    <%
    out.println(country.getName());//This is working
    %>
    </body>
    </html>This is the code for the bean
    package com.parispano.latinamericaguide;
    * @author Julien Martin
    * Represents a country.
    public class Country implements Comparable {
         private int id;
         private String name;
         private int landArea;
         private String capital;
         private String currency;
         private String flag;
         private String internet_domain;
         private String dialling_code;
         private float literacy;
         private float male_life_expectancy;
         private float female_life_expectancy;
         private String map;
         private int population;
         private int population_year;
         private float birth_rate;
         private int birth_rate_year;
         private float death_rate;
         private int death_rate_year;
         private int gdp;
         private int gdp_per_head;
         private int gdp_year;
         private float unemployment_rate;
         private int unemployment_rate_year;
         public Country() {
         public Country(
              int id,
              String name,
              int landArea,
              String capital,
              String currency,
              String flag,
              String internet_domain,
              String dialling_code,
              float literacy,
              float male_life_expectancy,
              float female_life_expectancy,
              String map,
              int population,
              int population_year,
              float birth_rate,
              int birth_rate_year,
              float death_rate,
              int death_year_rate,
              int gdp,
              int gdp_year,
              float unemployment_rate,
              int unemployment_rate_year) {
              this.id = id;
              this.name = name;
              this.landArea = landArea;
              this.capital = capital;
              this.currency = currency;
              this.flag = flag;
              this.internet_domain = internet_domain;
              this.dialling_code = dialling_code;
              this.literacy = literacy;
              this.male_life_expectancy = male_life_expectancy;
              this.female_life_expectancy = female_life_expectancy;
              this.map = map;
              this.population = population;
              this.population_year = population_year;
              this.birth_rate = birth_rate;
              this.birth_rate_year = birth_rate_year;
              this.death_rate = death_rate;
              this.death_rate_year = death_year_rate;
              this.gdp = gdp;
              this.gdp_year = gdp_year;
              this.unemployment_rate = unemployment_rate;
              this.unemployment_rate_year = unemployment_rate_year;
         public float getBirth_rate() {
              return birth_rate;
         public int getBirth_rate_year() {
              return birth_rate_year;
         public String getCapital() {
              return capital;
         public String getCurrency() {
              return currency;
         public float getDeath_rate() {
              return death_rate;
         public int getDeath_rate_year() {
              return death_rate_year;
         public String getDialling_code() {
              return dialling_code;
         public float getFemale_life_expectancy() {
              return female_life_expectancy;
         public String getFlag() {
              return flag;
         public int getGdp() {
              return gdp;
         public int getGdp_per_head() {
              return gdp / population;
         public int getGdp_year() {
              return gdp_year;
         public int getId() {
              return id;
         public String getInternet_domain() {
              return internet_domain;
         public float getLiteracy() {
              return literacy;
         public float getMale_life_expectancy() {
              return male_life_expectancy;
         public String getMap() {
              return map;
         public String getName() {
              return name;
         public int getPopulation() {
              return population;
         public int getPopulation_year() {
              return population_year;
         public int getLandArea() {
              return landArea;
         public float getUnemployment_rate() {
              return unemployment_rate;
         public int getUnemployment_rate_year() {
              return unemployment_rate_year;
         public void setBirth_rate(float f) {
              birth_rate = f;
         public void setBirth_rate_year(int i) {
              birth_rate_year = i;
         public void setCapital(String string) {
              capital = string;
         public void setCurrency(String string) {
              currency = string;
         public void setDeath_rate(float f) {
              death_rate = f;
         public void setDeath_rate_year(int i) {
              death_rate_year = i;
         public void setDialling_code(String string) {
              dialling_code = string;
         public void setFemale_life_expectancy(float f) {
              female_life_expectancy = f;
         public void setFlag(String string) {
              flag = string;
         public void setGdp(int i) {
              gdp = i;
         public void setGdp_per_head(int i) {
              gdp_per_head = gdp/population;
         public void setGdp_year(int i) {
              gdp_year = i;
         public void setId(int i) {
              id = i;
         public void setInternet_domain(String string) {
              internet_domain = string;
         public void setLiteracy(float f) {
              literacy = f;
         public void setMale_life_expectancy(float f) {
              male_life_expectancy = f;
         public void setMap(String string) {
              map = string;
         public void setName(String string) {
              name = string;
         public void setPopulation(int i) {
              population = i;
         public void setPopulation_year(int i) {
              population_year = i;
         public void setlandArea(int i) {
              landArea = i;
         public void setUnemployement_rate(float f) {
              unemployment_rate = f;
         public void setUnemployment_rate_year(int i) {
              unemployment_rate_year = i;
         public String toString() {
              return name;
         public int compareTo(Object o) {
              Country c = (Country)o;
              int cmp = name.compareTo(c.name);
              System.out.println(cmp);
              return cmp;
    }Can anyone please help?
    Thanks in advance,
    Julien.

    Thanks,
    I have added scope="application". It still show "null" indicating that the bean is not initialized with the properties. I would like a quicker way to initialize a bean property than invoking the setProperty tag for each property.
    Here is a simple example that demonstrates the problem:
    <%@ page language="java" %>
    <%@ page import="com.tests.*" %>
    <jsp:useBean id="monBean" class="com.tests.MonBean" scope="application"/>
    <%
    MonBean mb = new MonBean();
    mb.setName("toto");
    monBean= mb;
    %>
    <html>
    <head>
    <title>Lomboz JSP</title>
    </head>
    <body bgcolor="#FFFFFF">
    <jsp:getProperty name="monBean" property="name"/>
    </body>
    </html>And the bean
    package com.tests;
    public class MonBean {
    private String name;
    public String getName() {
         return name;
    public void setName(String name) {
         this.name = name;
    }This show "null".
    Any other idea why this is not working?
    Thanks,
    Julien

  • Assigning sequential numbers for every lines within a group of records

    The scenario is:
    This set of records with group number, lets say 100(group number) contains 7 lines/records. How to assign line numbers (sequential) for each line within these groups on the fly during the mapping process before inserting these set of rows in the target. I know it is easy to achieve in a procedure, but not sure how to do this in the mapping.
    please advice.
    Thanks,
    Prabha

    Use Rank function
    SQL> select empno,ename,deptno,(rank() over (partition by deptno order by empno)) seqno from emp;
    EMPNO ENAME DEPTNO SEQNO
    7782 CLARK 10 1
    7839 KING 10 2
    7934 MILLER 10 3
    7369 SMITH1 20 1
    7566 JONES 20 2
    7788 SCOTT 20 3
    7876 ADAMS 20 4
    7902 FORD 20 5
    7499 ALLEN 30 1
    7521 WARD 30 2
    7654 MARTIN 30 3
    7698 BLAKE 30 4
    7844 TURNER 30 5
    7900 JAMES 30 6
    1111 Test 40 1
    1222 test 1
    1333 2
    17 rows selected

  • Retireve Characteristic values that are assigned to a grid

    Hi All,
    Am creating a query to display all characteristic values that are assigned to an AFS Grid. The selection criteria is the AFS Grid which will return the characteristic values. I used the tables J-3APGHD - AFS Product Grid entries and CAWN - Characteristic values for this purpose. However I am unable to join these two tables. Is there any other way to do it or an interim table that would help me link the above two tables. Thanks i advance.
    regards,
    Imran

    Hi,
    Could you tell me how did you solve this problem, please?
    (Query between J_3APGHD and CAWN)
    Thanks

  • BASED ON SYSTEM LOGIN HOW TO ASSIGN SHARE POINT PAGE WITH OUT HAVING GROUP PERMISSION FOR THAT USER?

    Hi All,
    I am Srinivas, 
    How can i give permissions to Active Directory login User in SharePoint 2010. But user not in a group member  of SharePoint site.  is there any chance to assign a
    particular page to Active Directory user (He is not a member in SharePoint Group).
    Thank You
    Srinivas

    He doesn't need to be a member of a SharePoint Group.  You can create a SharePoint User based on the AD user and assign permissions to that user.
    Paul Stork SharePoint Server MVP
    Principal Architect: Blue Chip Consulting Group
    Blog: http://dontpapanic.com/blog
    Twitter: Follow @pstork
    Please remember to mark your question as "answered" if this solves your problem.

  • Function to Generate a Sequential incremental Number by Group of Records

    I have a table with several columns and I need to compute a sequential number by group of records
    FIELD1 FIELD2 FIELD3 FIELD4 FIELD5
    AAAAAA A1 JOHN 01/01/61 NULL
    AAAAAA A3 PAUL 01/01/71 NULL
    AAAAAA A3 MARY 01/01/02 NULL
    AAAAAA A4 CARL 01/01/04 NULL
    BBBBBB A1 MARK 01/01/60 NULL
    BBBBBB A2 ALLY 01/01/60 NULL
    BBBBBB A5 JUAN 01/01/04 NULL
    I need to compute FIELD5. This is defined as a number field.
    Records where FIELD2 = A1 the default value for FIELD5 is zero.
    I am grouping records by FIELD1, FIELD4
    The value for FIELD5 will be assigned from 1 TO 1+N
    For this sample, the resulting records will look like this;
    FIELD1 FIELD2 FIELD3 FIELD4 FIELD5
    AAAAAA A1 JOHN 01/01/61 0
    AAAAAA A3 PAUL 01/01/71 1
    AAAAAA A3 MARY 01/01/02 2
    AAAAAA A4 CARL 01/01/04 3
    BBBBBB A1 MARK 01/01/60 0
    BBBBBB A2 ALLY 01/01/60 1
    BBBBBB A5 JUAN 01/01/04 2
    Question: Can I create a function that loops through the table and compute the value for FIELD5?

    I like this idea, but because F2 must always have the value of ZERO I decided to create a procedure to calculate the value for F5.
    My procedure is below;
    The issue I am having is that I am not sure;
    1) When/where to set/reset the counter ?
    2) Determine in the inner loop if I am still whithin the same group of records ?
    3) When to update the new found value for MBR_MBR_DEP_CD field ?
    CREATE OR REPLACE PROCEDURE LC_BUILD_DEP_CODE_PROC IS
    V_ALT_ID VARCHAR2(30);
    V_EMPLOYEE_SSN VARCHAR2(9);
    --RELATIONSHIP_CD VARCHAR2(2);
    --MBR_DOB         DATE;
    V_ALT_ID_2 VARCHAR2(30);
    V_EMPLOYEE_SSN_2 VARCHAR2(9);
    V_MBR_DEP_CD_2 NUMBER(2,0);
    V_MBR_DEP_COUNTER INTEGER :=0;
    /* FIRST CURSOR */
    CURSOR GET_FAM_ALT_ID IS
    SELECT FAM.ALT_ID,
    FAM.EMPLOYEE_SSN
    FROM TPA_MBR_STG FAM
    WHERE FAM.RELATIONSHIP_CD = '18'
    ORDER BY FAM.ALT_ID;
    /* SECOND CURSOR */
    CURSOR GET_MBR_DEP_CD IS
    SELECT MBR.ALT_ID,
    MBR.EMPLOYEE_SSN,
    MBR.MBR_DOB,
    MBR.MBR_DEP_CD
    FROM TPA_MBR_STG MBR
    --WHERE MBR.ALT_ID = V_ALT_ID
    --AND   MBR.EMPLOYEE_SSN = V_EMPLOYEE_SSN
    WHERE MBR.RELATIONSHIP_CD <> '18'
    ORDER BY MBR.ALT_ID, MBR.MBR_DOB;
    BEGIN
    -- OPEN FIRST CURSOR
    OPEN GET_FAM_ALT_ID;
    LOOP
    FETCH GET_FAM_ALT_ID INTO V_ALT_ID,
    V_EMPLOYEE_SSN;
    OPEN GET_MBR_DEP_CD;
    FETCH GET_MBR_DEP_CD INTO V_ALT_ID_2,
    V_EMPLOYEE_SSN_2;
    IF V_ALT_ID_2 = V_ALT_ID
    AND V_EMPLOYEE_SSN_2 = V_EMPLOYEE_SSN
    THEN
    LOOP
    V_MBR_DEP_COUNTER = V_MBR_DEP_COUNTER + 1;
    UPDATE TPA_MBR_STG
    SET MBR_MBR_DEP_CD = V_MBR_DEP_COUNTER;
    END LOOP;
    END IF;
    CLOSE GET_MBR_DEP_CD;
    V_MBR_DEP_COUNTER :=0;
    END LOOP;
    CLOSE GET_FAM_ALT_ID;
    EXCEPTION
    WHEN OTHERS THEN
    RAISE_APPLICATION_ERROR(-20001,'AN ERROR WAS ENCOUNTERED - '||SQLCODE||' -
    ERROR- '||SQLERRM);
    END LC_BUILD_DEP_CODE_PROC;

  • Assigning a value to screen field

    Hi,
      Anybody knows how to assign a value to a field in a standard transaction without using parameter ID.
    Pionts will be awarded.
    Thanks,
    lakshmi.

    Thank you so much Rich & eswar. here is my problem.
    Actually I am updating this field based on the contract starts date and material group using one user exit.But this field is geting updated whenever there is a change to this field.it is not geting updated in other cases that is "it is geting updated if you are changing the contents of the filed or giving a new value".
    But I want this field updated all the times.
        So I thought I will assign a dummy value to this filed before I update it.For this We need a parameter id. but it is not there. So I am searching for other solution.
      Can you please help me.
    Regards,
    Lakshmi

  • 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

  • How to assign attribute values to a range of BPs ????

    Hi All,
         While assigning attribute values to business partners we can specify at the most one business partner at a time.
    My requirement is to assign attribute values to a range of business partners at a time.
    Is there any customization setting where I can do this OR
    do I write a report for this ?
    Regards,
    Ashish

    Hi Ravi,
          Thanks for replying !!!!
    But, CRMD_MKT_TOOLS doesnt seem to solve my problem.
    I have a range of BPs (e.g 8000101 to 8000199).
    And I have a list of attribute sets with values as follows:-
    Attribute Set            Values
    Age group                1 - 10, 11 - 20, ....
    Reading habits          Business, sports, news.....
    Profession                Doctor , Engineer .......
    and so on..
    Now in transaction CRMD_PROF_BP, I can choose a single BP (e.g. 8000101) and assign it an attribute set(e.g. Profession) and value (Doctor).
    But, my requirement is to specify an entire range of BPs(8000101 to 8000150) and assign attribute set and values to that entire range.
    Now how do I achieve this ???????
    (target groups would be created only after attributes have been assigned)
    Regards,
    Ashish

  • Error when assigning a value to a class

    Hi,
    Here's what I have:
    package com.myprograms.tools1;
    public class A
    public long orderId;
    public int nameId;
    public int carId;
    public int anId;
    package com.myprograms.tools1;
    public class B
    public A classOfA;
    //MAIN Program
    import com.myprograms.tools1;
    public class getClass
    B b= new B();
    b.classOfA.orderId = 10029292;
    I get a Null Pointer Exception when I assign a value to the var.
    Can anybody help point out the problem?
    Thanks!

    What exactly is the error message... i.e. line numbers and class names...
    Example: Full thread dump Java HotSpot(TM) Client VM (1.5.0-beta2-b51 mixed mode, sharing
    "SIGINT handler" daemon prio=10 tid=0x03264410 nid=0xea0 waiting for monitor ent
    ry [0x080bf000..0x080bfa68]
            at java.lang.Shutdown.exit(Unknown Source)
            - waiting to lock <0x2b31a868> (a java.lang.Class)
            at java.lang.Terminator$1.handle(Unknown Source)
            at sun.misc.Signal$1.run(Unknown Source)
            at java.lang.Thread.run(Unknown Source)Okay, that was too funny... LOL...
    This example error is courtesy of me being a complete... Well, let's just say, that was dumb...
    It has almost been an hour since I launched off that little app...
    You know you did something wrong when you can actually hear the HardDrive and Fan slow down...
    Anyway... LOL... what are the errors, and what is the rest of the code ? or is it fixed now...
    - MaxxDmg...
    - ' He who never sleeps... '

  • Assign a value from dropdownlist to input field value on BSP page

    Hi,
    I'm new to SAP and ABAP. We have a CRM project in which I have to maintain BSP pages.
    Now, coming to my problem: I have a input field with
    value = "//BTAdminH/HeaderInfo"
    This field is normally maintainable. The required function is now to set this field as not maintainable/readonly. Then, the value should be set automatically to an value, which will be selected from a dropdownListBox. After saving, the value HeaderInfo should have the same value like the selected value from the dropdownListBox.
    How can I now set the field as readonly (this should be the easier part) and
    how can I set the value for the HeaderInfo to the value of the selected value from the dropdownListBox?
    If I set it directly like this
    value = "//BTActivity/Priority"
    it is shown on the BSP page correclty, but it is not saved as HeaderInfo.
    Please help me.
    Enja

    Hello Gokul,
    test was only for test purposes! I am using as a separator the plus sign!
    But this is not the problem!
    In debugging, the local variable has the concatenated value! So, this is working!
    oncatenate ls_ddlb1-value ls_ddlb2-value ls_ddlb3-value into lv_headerinfo SEPARATED BY ' + '.
    But when I assign the value of my set_headerinfo to the local variable, then it is returning only the separator sign!!!
    if BTAdminH->GET_HEADERINFO( 'HEADERINFO' ) is initial.
        BTAdminH->SET_HEADERINFO( attribute_path = 'HEADERINFO' value = lv_headerinfo ).
      endif.
    If I declare the local variable as one of the dropdown values, then it is getting populated also for set_headerinfo
    lv_headerinfo  =ls_ddlb1-value.
    So, the assigning is also working! But it is not working, when the local variable equals more than one value! I hope that I could explained it in the right way for you!!!!
    So. why is the value for set_headerinfo not the same as the one for the local variable! The local variable has the correct value after the concatination.
    Regards
    Enja

  • Assigning a value to a parameter.

    Hi all,
    I am using CR XI, developping a report built upon a query in BW (using SAP Kit). The query in BW has a parameter PARAM1 of type string that comes automatically into my report but the type or the parameter is greyed. I can't change it.
    In reality, I am expecting a date to be entered. It would be more user friendly to offer the user the calendar interface to select a value rather than the textbox for a string.
    I can create a second parameter PARAM2 of type Date in CR, transform the input value to string but I do not know how to assign the result to PARAM1.
    I have tried an assignment in a formula using beforereadingreports but no luck.
    Does anybody know how to do this or if this is even possible ?
    Thanks.

    Thanks Graham - sorry it took me so long.
    That is an interesting suggestion that I did not think of. I tried but for some reason the parameter for the report against BW does not show up in the link part of the subreport definition. I created a "fake" main report with a date type parameter, a formula to translate it to a string but no way to "assign" its value to the parameter in the original report.
    Queries against SAP seem to have "specificities"...
    In other words, i am still stuck !

  • OpenSQLException - Cannot assign double value

    Hello,
      I have some table in database with field of type 'double'. I use JDBC to store data in this table and sometimes I would like to place special values in it, eg:
    preparedStatement.setDouble(1, Double.MIN_VALUE);
    Unfortunately I get exception like the one below.
    My question is: what is the allowed range of values for type 'double' in database according to OpenSQL spec ?
    Thanks!
    Marcin Zduniak
      com.sap.sql.log.OpenSQLException: Cannot assign double value 4.9E-324 to host variable 3 because it is not in the allowed range of +/- to +/-.
        at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Syslog.java:85)
        at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Syslog.java:124)
        at com.sap.sql.jdbc.common.CommonPreparedStatement.setDouble(CommonPreparedStatement.java:534)
        at com.sap.engine.services.dbpool.wrappers.PreparedStatementWrapper.setDouble(PreparedStatementWrapper.java:281)
        at pl.com.bcc.hai.SpecificationBean0Persistent.ejb_iUpdate(SpecificationBean0Persistent.java:558)
        ... 42 more
    Full exception chain:
    com.sap.engine.services.ejb.exceptions.BaseEJBException: Transaction system failure in method pl.com.bcc.hai.SpecificationLocalLocalObjectImpl0.setTargetValue(java.lang.Double).
         at pl.com.bcc.hai.SpecificationLocalLocalObjectImpl0.setTargetValue(SpecificationLocalLocalObjectImpl0.java:4537)
         at pl.com.bcc.hai.conf.BCC_H_CConfig.setSTimeSeriesesAIM(BCC_H_CConfig.java:4129)
         at pl.com.bcc.hai.conf.wdp.InternalBCC_H_CConfig.setSTimeSeriesesAIM(InternalBCC_H_CConfig.java:1038)
         at pl.com.bcc.hai.conf.wdp.IPublicBCC_H_CConfig$ISTimeSeriesesElement.setAIM(IPublicBCC_H_CConfig.java:3651)
         at pl.com.bcc.hai.conf.wdp.IPublicBCC_H_CConfig$ISTimeSeriesesElement.wdSetObject(IPublicBCC_H_CConfig.java:3786)
         at com.sap.tc.webdynpro.progmodel.context.MappedNodeElement.wdSetObject(MappedNodeElement.java:365)
         at pl.com.bcc.hai.conf.wdp.IPrivateSpecificationEditor$ISTimeSeriesesElement.wdSetObject(IPrivateSpecificationEditor.java:1737)
         at com.sap.tc.webdynpro.progmodel.context.AttributePointer.setObject(AttributePointer.java:223)
         at com.sap.tc.webdynpro.clientserver.data.DataContainer.transportPendingUserInput(DataContainer.java:1267)
         at com.sap.tc.webdynpro.clientserver.data.DataContainer.transportPendingUserInput(DataContainer.java:474)
         at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.transport(ClientComponent.java:548)
         at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.transport(ClientComponent.java:552)
         at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.transport(ClientApplication.java:701)
         at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.transportData(WebDynproMainTask.java:717)
         at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:649)
         at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)
         at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:251)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:55)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    Caused by: com.sap.engine.services.ts.exceptions.BaseRollbackException: Exception in beforeCompletition of ( SAP J2EE Engine JTA Transaction : [1a55ffffffb01205ffffffd4ffffffdd] ).
         at com.sap.engine.services.ts.jta.impl.TransactionImpl.commit(TransactionImpl.java:232)
         at pl.com.bcc.hai.SpecificationLocalLocalObjectImpl0.setTargetValue(SpecificationLocalLocalObjectImpl0.java:4486)
         ... 35 more
    Caused by: com.sap.engine.services.ejb.exceptions.BaseEJBException: SQLException while the data is being flushed. The persistent object is pl.com.bcc.hai.SpecificationBean0Persistent.
         at com.sap.engine.services.ejb.entity.pm.UpdatablePersistent.ejbFlush(UpdatablePersistent.java:101)
         at com.sap.engine.services.ejb.entity.pm.TransactionContext.flushAll(TransactionContext.java:429)
         at com.sap.engine.services.ejb.entity.pm.TransactionContext.flush(TransactionContext.java:378)
         at com.sap.engine.services.ejb.entity.pm.TransactionContext.beforeCompletion(TransactionContext.java:506)
         at com.sap.engine.services.ejb.entity.SynchronizationList.beforeCompletion(SynchronizationList.java:136)
         at com.sap.engine.services.ts.jta.impl.TransactionImpl.commit(TransactionImpl.java:220)
         ... 36 more
    Caused by: com.sap.sql.log.OpenSQLException: Cannot assign double value 4.9E-324 to host variable 3 because it is not in the allowed range of +/- to +/-.
         at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Syslog.java:85)
         at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Syslog.java:124)
         at com.sap.sql.jdbc.common.CommonPreparedStatement.setDouble(CommonPreparedStatement.java:534)
         at com.sap.engine.services.dbpool.wrappers.PreparedStatementWrapper.setDouble(PreparedStatementWrapper.java:281)
         at pl.com.bcc.hai.SpecificationBean0Persistent.ejb_iUpdate(SpecificationBean0Persistent.java:558)
         at com.sap.engine.services.ejb.entity.pm.UpdatablePersistent.ejbFlush(UpdatablePersistent.java:80)
         ... 41 more
    com.sap.engine.services.ts.exceptions.BaseRollbackException: Exception in beforeCompletition of ( SAP J2EE Engine JTA Transaction : [1a55ffffffb01205ffffffd4ffffffdd] ).
         at com.sap.engine.services.ts.jta.impl.TransactionImpl.commit(TransactionImpl.java:232)
         at pl.com.bcc.hai.SpecificationLocalLocalObjectImpl0.setTargetValue(SpecificationLocalLocalObjectImpl0.java:4486)
         at pl.com.bcc.hai.conf.BCC_H_CConfig.setSTimeSeriesesAIM(BCC_H_CConfig.java:4129)
         at pl.com.bcc.hai.conf.wdp.InternalBCC_H_CConfig.setSTimeSeriesesAIM(InternalBCC_H_CConfig.java:1038)
         at pl.com.bcc.hai.conf.wdp.IPublicBCC_H_CConfig$ISTimeSeriesesElement.setAIM(IPublicBCC_H_CConfig.java:3651)
         at pl.com.bcc.hai.conf.wdp.IPublicBCC_H_CConfig$ISTimeSeriesesElement.wdSetObject(IPublicBCC_H_CConfig.java:3786)
         at com.sap.tc.webdynpro.progmodel.context.MappedNodeElement.wdSetObject(MappedNodeElement.java:365)
         at pl.com.bcc.hai.conf.wdp.IPrivateSpecificationEditor$ISTimeSeriesesElement.wdSetObject(IPrivateSpecificationEditor.java:1737)
         at com.sap.tc.webdynpro.progmodel.context.AttributePointer.setObject(AttributePointer.java:223)
         at com.sap.tc.webdynpro.clientserver.data.DataContainer.transportPendingUserInput(DataContainer.java:1267)
         at com.sap.tc.webdynpro.clientserver.data.DataContainer.transportPendingUserInput(DataContainer.java:474)
         at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.transport(ClientComponent.java:548)
         at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.transport(ClientComponent.java:552)
         at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.transport(ClientApplication.java:701)
         at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.transportData(WebDynproMainTask.java:717)
         at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:649)
         at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)
         at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:251)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:55)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    Caused by: com.sap.engine.services.ejb.exceptions.BaseEJBException: SQLException while the data is being flushed. The persistent object is pl.com.bcc.hai.SpecificationBean0Persistent.
         at com.sap.engine.services.ejb.entity.pm.UpdatablePersistent.ejbFlush(UpdatablePersistent.java:101)
         at com.sap.engine.services.ejb.entity.pm.TransactionContext.flushAll(TransactionContext.java:429)
         at com.sap.engine.services.ejb.entity.pm.TransactionContext.flush(TransactionContext.java:378)
         at com.sap.engine.services.ejb.entity.pm.TransactionContext.beforeCompletion(TransactionContext.java:506)
         at com.sap.engine.services.ejb.entity.SynchronizationList.beforeCompletion(SynchronizationList.java:136)
         at com.sap.engine.services.ts.jta.impl.TransactionImpl.commit(TransactionImpl.java:220)
         ... 36 more
    Caused by: com.sap.sql.log.OpenSQLException: Cannot assign double value 4.9E-324 to host variable 3 because it is not in the allowed range of +/- to +/-.
         at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Syslog.java:85)
         at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Syslog.java:124)
         at com.sap.sql.jdbc.common.CommonPreparedStatement.setDouble(CommonPreparedStatement.java:534)
         at com.sap.engine.services.dbpool.wrappers.PreparedStatementWrapper.setDouble(PreparedStatementWrapper.java:281)
         at pl.com.bcc.hai.SpecificationBean0Persistent.ejb_iUpdate(SpecificationBean0Persistent.java:558)
         at com.sap.engine.services.ejb.entity.pm.UpdatablePersistent.ejbFlush(UpdatablePersistent.java:80)
         ... 41 more

    Hi,
       Thank you for your replay. I didn't touch DB directly, I defined db structure through NetWeaver Dictionary perspective and table that i'm interested in is defined like the one on this screen: http://zduniak.com/tmp/sap_dictionary_double.png
    So I'm looking for generic solution (SAP OpenSQL), not specific to any particular DB vendor.
    Maybe there is somewhere on help.sap.com (i couldn't find unfortunately) information what is the allowed range of values for type 'double' in database according to OpenSQL spec ?
    Thank,
      Marcin Zduniak

  • How to assign the Value to the Particular field-Text field

    Hi all,
    My requirement is to call the Web service with input from the ADF page.
    Steps I have done:
    1. I have created a Web service data control based on the WSDL file.
    2. Just drag and drop the Process, It is automatically created the form with the Input fields and then the Process button
    3. When I entered the values and then process button it will pass the values corretly.the web service is invoked correctly with the values entered.
    4. But when I try to assign the value from the some other field that is not working.
    I am assigning the Value to the field by go to the properties of the Particular field value =”CREATE”
    When I do like this that value is showing in the screen. But it will not pass the value to the web service.
    I think the value is only displaying in the screen. Not stored at bindings level. Kindly guide me in this.
    Thanks in Advance
    C.Karukkuvel

    If you want to have the value that is returned displayed in a field that has binding to another item and not the WS result item then the way to do this would be to override the method that is invoked with the button that calls the web service - you then take the result and assign it to the item you want.
    See the way it is done here:
    http://blogs.oracle.com/shay/2009/07/java_class_data_control_and_ad.html
    While this sample uses a simple method it would be basically the same for a Web service.

Maybe you are looking for

  • My iMac crashed, how to backup my files from a dead drive

    Hi, I need to backup my files, I haven't made any backup before, not even a time machine. I started up using the CD that came with it but DU isn't able to repair my disk. I know I made a mistake by not making any backup before but please help if you

  • When I try to open a PDF form from a site, my screen goes black.

    When I try to open a fillable PDF form from any web site my screen goes black and nothing further happens. I can use IE with success, but would prefer Firefox.

  • Anyone bought a refurbished macbook???

    i am starting to have the jitters after having read all the 'mafunctions' on this site... i am relatively new to Mac and have just ordered a refurbished Macbook Pro 15/2.4ghz... it is due to arrive on Tuesday/Wednesday... now i am wondering if i have

  • No auto-reboot with WSUS

    Hi all We're currently trying to set up a WSUS in our firm, to make updating servers easier and less of a time-wasting work. The goal would be, for the servers to automatically install the updates and then reboot, so a collegue or me only have to che

  • How to play other audio files in Podcasts app?

    Hi all. Whenever I add audiobooks or recordings of radio shows to my iPhone, they go into the Music app. However, this doesn't have a placeholder function (that is, it doesn't remember at which you point you paused the file) or a sleep timer like the