Auto increment number in BO

Hello All,
In my CAF code, I need to persist one variable and increment in every time the AS is called. To elaborate further, I have a business object (entity service) which stores the customer records. The customer number has to be auto incremented. The response of this service is the customer number which is auto generated.
Please let me know how to go about it simplistically. Do we have the concept of static variables, the same of instance of which can be accessed by various service calls?
Thanking you all in anticipation.
Regards,
Keerti

Hi Keerthi,
You can use the concept of static.
If i had understood correctly, you need to have an operation in Application Service(AS) to create a Customer BO and each time  a customer BO is formed it shopuld be given a customer ny=umber in an auto increment fashion.
For this you can have the following code in your create method of the AS
try {
               StatObj ob = this.getstatObjService().create();
               i++;
               ob.setCustNumber(i);
               this.getstatObjService().update(ob);
          } catch (CAFCreateException e) {
          } catch (CAFUpdateException cue) {
          } catch (CAFPessimisticLockException cple) {
          } catch (CAFOptimisticLockException cole) {
StatObj is my BO and CustNumber is an int in the BO.
Hope it solves your problem.
Hi keerthi,
Is the problem solved.
Regards,
Srinivasan Subbiah
Edited by: Srinivasan Subbiah on Apr 28, 2008 8:55 AM

Similar Messages

  • Re auto increment number

    Hi experts
                          i had a fms query for auto increment number  for a field  query is
    SELECT 'HB#'+cast((MAX(SubString(U_VSPPROJ,4,Len(U_VSPPROJ)))+1)  as Varchar(4))  from ORDR where U_VSPPROJ Like 'HB#%%'
    gives a result of  HB#1 to HB#999 this is for financial year 13-14 but now i want to reset it from HB1 for this FI year how can i do that
    Please help me on this
    Regards
    Prathap

    Hi
    The Query is
    SELECT 'HB#'+cast((MAX(SubString(U_VSPPROJ,4,Len(U_VSPPROJ)))+1)  as Varchar(4))  from ORDR where U_VSPPROJ Like 'HB#%%'
    given a result of  HB#1 to increasing +1 value in previous year 2013-14
    now i want same from HB#1 in this fi year  2014-15
    how to reset it from HB#1 from this f year
    please help me on this
    Thanks and Regards
    Prathap

  • Auto increment number field

    Hello,
    I would like to have a number field to be auto increment. Ho can I do that in Oracle must I use some code for it or can I make the field auto increment by itself.
    Thanks

    user3311314 wrote:
    Hello,
    I would like to have a number field to be auto increment. Ho can I do that in Oracle must I use some code for it or can I make the field auto increment by itself.
    ThanksIt's a long standing gripe of mine. You must use code, and the appropriate solution is a sequence and a trigger, eg
    SASH_CLIENT @ DB10G >create table t(
      2      id number not null primary key
      3  ,   c1 char(100));
    Table created.
    SASH_CLIENT @ DB10G >
    SASH_CLIENT @ DB10G >create sequence seq_t;
    Sequence created
    SASH_CLIENT @ DB10G >
    SASH_CLIENT @ DB10G >create or replace trigger bir_t
      2  before insert on t
      3  for each row
      4  begin
      5  select seq_t.nextval into :new.id from dual;
      6  end;
      7  /
    Trigger created.
    SASH_CLIENT @ DB10G >insert into t(c1) values ('row 1');
    1 row created.
    SASH_CLIENT @ DB10G >commit;
    Commit complete.
    SASH_CLIENT @ DB10G >select * from t;
            ID C1
             1 row 1I'd much prefer
    create table t (
       id number primary key default seq_t.nextval
    ,  c1 char(100));

  • Is there easy way to create auto increment number?

    Hello SharePoint Fam,
    Is there a easy solution to have a auto increment column that just creates new number on each new item.
    Wanting something like:
    14-0001
    14-0002
    14-0003
    14-0004
    14-0005
    Thanks n advance

    If you need a simple auto increment column then you can use "ID" field which is already present in Sharepoint. 
    It will increment in this fashion: 1,2,3,4...........
    or
    you can take field as "Calculated" and use formula (="14-" & [ID]) without parentheses.
    it will increment in this fashion 14-1, 14-2, 14-3............
    or
    try this link...may be you will find something helpful here...
    http://dlairman.wordpress.com/2011/01/10/add-a-unique-auto-incrementing-column-to-a-sharepoint-list/
    ***If my post is answer for your query please mark as answer***
    ***If my answer is helpful please vote ***

  • Auto increment number with leading zeros

    hello,
    i have data column (serial number) that auto generate from script component, i'm using counter +1 and it successful store the number to my db. but the problem is there any idea to store the number to 00001 rather that 1.
    im using this method in my script component
    dim counter as integer = 0
    counter =counter + 1
    row.NoSerial = counter
    TQ

    Why should you send it through the file? WHy not simply create a calculated column based on identity field or sequence based field (if 2012 version and above)  in the destination table and ignore it from the file altogether. ANyways its going to be
    a sequential auotogenerated value isnt it?
    http://www.sqlteam.com/article/custom-auto-generated-sequences-with-sql-server
    If you want to bring it as  00001 etc you need to make it as varchar and use derived column expressions in SSIS as source is text file.
    I would prefer doing this in sqlserver if its just a sequential number and has no direct relationship to the incoming file data fields.
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Use a auto incremented number across multiple lists

    As we use lots of sites which all have their own issue list to track issues per project, i was wondering whether it's possible to add a column to these lists (to their content type) which automatically adds a number which is unique across all lists/sites.
    Is this possible?

    Lists have a Unique ID attached to each item (hidden field) that you could potentially use, but you will have to come up with a custom solution if you don't want ID's to be duplicated across your site collection. One thought is to attach a workflow to
    each list you want unique ID's for, and copy the content to a separate list. This will create the unique ID's you are after.
    List 1 > Workflow > ContainerList with unique ID
    List 2 > Workflow > ContainerList with unique ID
    While the originating lists will have their own 'unique' ID's, the TRUE unique ID you are after will be contained in the "Container" list. As each item is added, the workflow will create a duplicate item in the "Container" list, which will
    also have a unique ID assigned to it. This way, all lists with the attached workflow will have a separate ID in the "Container" list you can utilize. Messy, but it works.

  • Auto increment numbers in Oracle 8i

    Hi all,
    How to have an auto increment number as a primary key of a table in Oracel 8i(8.1.7) ?. Is it possible to specify to use a sequence as a column ?
    Antony Paul

    You can create a BEFORE INSERT trigger that uses the sequence to populate the primary key column. If you are coming from SQL Server, that's the closest approximation to an IDENTITY column.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Auto increment field with reset in a query

    Hi,
    I have the following query, I want 'field number' should count as a auto increment number and reset accordingly a group. e.g
    for the group 1 if there are 10 rows then it should give me rownum as 1--10
    for the group 2 if therea are 5 rows then it should give me rownum as 1--5
    select d.drop_prog_id,
    a.opre_cms_oppty_id,
    c.more_tipo_revisione,
    decode(f.grdo_prog_id,16,null,
    decode(f.grdo_prog_id,75,'Other','Euro')
    ) Field_Number,
    decode(f.grdo_prog_id,16,e.doma_testo, f.grdo_descrizione) GROUP1,
    decode(f.grdo_prog_id,16,h.risp_valore,d.drop_valore_risposta) MILESTONE_RESPONSE,
    d.drop_valore_commento1,
    d.drop_valore_commento2
    from wrt.tr002_opportunita_revisioni a,
    wrt.tr005_opportunita_rev_moduli b,
    wrt.tr008_moduli_revisione c,
    wrt.tr006_domande_risposte_oppor d,
    wrt.tr009_moduli_domande g,
    wrt.tr010_domande e,
    wrt.tr012_gruppo_domande f,
    wrt.tr015_risposte h
    where b.ormo_opre_prog_id = a.opre_prog_id and c.more_prog_id in (1, 19) and
    d.drop_ormo_prog_id = b.ormo_prog_id
    and d.drop_modo_prog_id = g.modo_prog_id
    and g.modo_more_prog_id = c.more_prog_id and
    g.modo_doma_prog_id = e.doma_prog_id
    and e.doma_grdo_prog_id = f.grdo_prog_id
    and (f.grdo_prog_id in (76, 75)
    or (e.doma_testo like '%Are payment terms from invoice%' and
    f.grdo_prog_id = 16))
    and a.opre_ultima_revisione = 'S'
    and h.risp_prog_id = d.drop_risp_prog_id
    group by d.drop_prog_id,
    a.opre_cms_oppty_id,
    c.more_tipo_revisione,
    drop_prog_id,
    e.doma_testo,
    d.drop_valore_risposta,
    h.risp_valore,
    d.drop_valore_commento1,
    d.drop_valore_commento2,
    f.grdo_descrizione,
    f.grdo_prog_id
    order by a.opre_cms_oppty_id,
    min(f.GRDO_ORDINE) ,
    min(g.MODO_ORDINE)

    row_number() over (partition by <group> order by <whatever>)

  • Composite Primary Key or Auto Increment key ?

    Hi.. i have two ways for make something and don't know what's better ......
    Problem : 3 tables
    Client ----> ( 1,* ) Activity -----> (1,1) ActivityAccreditation
    A Client it can have one or more activities, and one Activity have one ActivityAccreditation. On Client the primary key is CLIENT_ID, the two ways for generate the keys on the other tables are :
    a ) On Activity the primary key is composed by CLIENT_ID and SEQUENCE_ACTIVITY ( a number than increment value by CLIENT_ID, example : CLIENT_ID = 1122 could have SEQUENCE_ACTIVITY from 1 to 3 for three activities, and CLIENT_ID = 1122 could have SEQUENCE_ACTIVITY from 1 to 4 for four activities ), and ActivityAccreditation have CLIENT_ID and SEQUENCE_ACTIVITY and ACCREDITATION_TYPE ( a code ).
    b) On Activity the primary key is ACTIVITY_ID ( auto increment number ) with the CLIENT_ID like foreign key only. And on ActivityAccreditation have ACTIVITY_ACCREDITATION_ID like primary key and ACTIVITY_ID like foreign key.
    The situation is than the numer of rows could to grow very much in the time ( 3.000.000 rows on ActivityAccreditation in one year and the database to be supported each five years ) and we don't know what solution is better by performance......
    Tks.

    I prefer the surrogate key.
    I don't like composite keys as a rule because they tend to inject business logic into keys. Using surrogate keys eliminates this possibility.
    For performance reasons, this means that you might want to create additional indexes on those columns to facilitate fast access. But my prejudice is to stick with surrogate keys.
    I will admit that I'm not a DBA, so there are certain to be alternative views and arguments. We'll see if any of them pop up on this thread.

  • Auto-increment workflow reset

    I have Sharepoint 2013, but created a Workflow in Sharepoint designer with Sharepont 2010 Workflow to assign an auto-increment column to a list. I have tested the list and the auto-incrementing is working great, however now I want to actively use the list
    in the 'real' working capacity, but when I've deleted the previously entered test items the auto-increment column proceeds to increase. How can I restart/reset the number back to where it should start? Is it possible? Or do I need to delete my list and start
    all over again from scratch both list and workflow?

    Hi Tam,
    How did you set the workflow to assign an auto-increment column to a list?
    If the workflow is different, then there should be different solutions.
    If you are using another list to store the numbers for the auto-increment column, then you can modify the columns in that list to be the value that you want to start with.
    Here is a link about using another list to recalculate the next number with workflow:
    http://gihanmaduranga.blogspot.jp/2012/09/create-auto-increment-number-column-in.html
    If that is case of your workflow, then you can edit the Last Number column in the Counter list to be a number which you want to start with.
    If you are using a different solution, could you please provide the detail steps of how you set the auto-increment column?
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • Auto increment variable in foreach loop in ssis

    i know this has been asked N number of times, but still i have a question for you guys
    i have files sitting in FTP location
    i am loading the data from the files into tables (no issues)
    but i need to assign value to a particular column as -99999999 and then auto increment that number while loading the files into the database
    I cannot have auto increment for the that particular column
    should i use a derived column, script component, execute sql task?
    can somebody point me to the right direction
    if it were a single file, assigning the auto incremental number is easy, but with for each loop, i am not able to get the solution
    Thanks

    Hi Jack,
    To achieve your goal, you can use a Row Count Transformation in the Data Flow Task to get row count for each file, and then use an Execute SQL Task after the Data Flow Task to update the total row count variable. Supposing the variable used in the Row Count
    Transformation is InsertCount, the variable used to store the total row count is TotalInsertCount. We need to set the ResultSet of the Execute SQL Task to “Single row”, and the SQLStatement to:
    DECLARE @Insert_Count INT, @Total_Insert_Count INT
    SET @Insert_Count=?
    SET @Total_Insert_Count=?
    SET @Total_Insert_Count=@Total_Insert_Count + @Insert_Count
    SELECT R_Total_Insert_Count=@Total_Insert_Count
    Then, set the Parameter Mapping of the Execute SQL Task, we map variable InsertCount and TotalInsertCount to the parameters in the SQL statement respectively. In the ResultSet page of the Execute SQL Task, map the resultset to variable TotalInsertCount.
    Please refer to the following screenshot:
    Regards,
    Mike Yin
    TechNet Community Support

  • Auto Increment UDF

    Hi there experts,
    I'm just curious if its possible to have an auto increment number on udf ? I have a test server and I'm just curios about it but I don't know if its possible or not.
    Thanks in advance guys.
    Warm regards,
    Tony

    Hi Tony,
    Say you created an udf U_Test for marketing document AR Invoice.
    Now you want an auto increment on that udf for every invoice created, then you need to use the following FMS;
    Select max(T0.[U_Test])+1 from OINV T0 where T0.Series = $[OINV.Series]
    execute this query in query generator and save it. Press AltshiftF2 on udf and assign this formatted search in this udf.
    You may set it to auto refresh on docnum else you may press shift+F2 to get the desired output. Hope this helps.
    All the best!!
    Thanks,
    Joseph

  • Auto-increment receipt number?

    Hi,
    I'm trying to increment a single number, and not having much luck.  Here's what I'm doing:
    My tennis club needs to print about three hundred receipts.  I've designed a master page in Indesign CS4.  On that master page, in landscape format, I have eight identical receipts arranged in a 2 x 4 arrangement (so as to be able to print eight receipts on one page).
    On each receipt, I have a single "receipt number" which I'd like to automatically increment on each receipt: "0000001", "0000002", "0000003", etc.  So, ideally, I'd be able to simply set up the auto-increment, apply the master page to about 30 pages or so, and the last receipt on the last page would be numbered at "0000300".
    However, I'm not entirely sure how to do this.  Do I use a text variable of some sort?  I tried going to that, but nothing I tried worked.
    Thanks!

    This is discussed fairly regularly. Solutions range from creating a one-receipt-per-page document in which you use an automatic page number, and then place that file inito a new N-up layout, to Data Merge, to simply placing a number list saved as a text file.
    I've used both of the last two and find them pretty easy. I'm fond of the Data Merge approach because it allows me to very easily arrange the numbers on the sheets so they are printed in stacks and don't need to be sorted after cutting. You can do that in a palin text file, too, but I find it less intuitive.
    For doing that with Data Merge I set up a spread sheet with X columns and Y rows. X is the number of tickets or receipts on a single page, Y is the number of sheets required to print all the numbers. I start by filling the first three cells in the first column reading down in consecutive order, then use auto fill to complete the column. Repeat for the next two columns, then you can use auto-fill to complete all the rows. Add a new row at the top for field names for Data Merge and export as comma separated text.
    Put the placeholders for all the receipts on the page and do a single-record-per-page merge.

  • How to auto increment a NUMBER(10) datatype

    Anyone know the syntax on how to auto increment a number field every time a new row comes in?
    TIA
    CREATE TABLE loc_color_group_values(
         ID number(10) NOT NULL auto_increment, <----------------
         COLOR_CODE_ID number(10) default 0,
         PROD_LOC_ID number(10) default 0,
         COLOR_GROUP_CODE_ID number(10) default 0,
         PRIMARY KEY(ID)
    );

    Here is an example:
    CREATE OR REPLACE TRIGGER "EXAMPLE_TRIG" BEFORE
    INSERT ON "loc_color_group_values" FOR EACH ROW BEGIN
      IF :NEW.id IS NULL THEN
        SELECT loc_color_group_values_seq.nextval INTO :NEW.id FROM dual ;
      END IF;
    END ;This allows you to overide the sequence without having to disable the trigger.

  • Create Auto increment sequence number for list view report

    Hi All,
              Am using BAM 11.1.1.6 version, Have updating list report & wants to create auto increment sequence number at report level. Is it possible to create column at run time in BAM reports.
    Please help.
    Thanks.

    Hi All,
              Am using BAM 11.1.1.6 version, Have updating list report & wants to create auto increment sequence number at report level. Is it possible to create column at run time in BAM reports.
    Please help.
    Thanks.

Maybe you are looking for

  • Downgrade From Windows Vista Home to Windows XP Pro Dutch on Satellite P200-15N

    Not knowing where I really should put this .. I put it in this forum part too :) So : Hello, I bought a new laptop with Vista Home and two Partitions... I would like to install on the Second partition "Windows XP pro" (with official key & SP2 include

  • Remove words from Swype?

    Hello, Somehow I managed to get some words in Swype and I want to remove them. How do I remove them from my phones list of words? Thanks, VeePee Nokia 3395 Nokia 6600 Nokia N95 8GB Nokia N8 (Anna) Nokia Lumia 930 Solved! Go to Solution.

  • Clean install Snow Leopard and transfer files from Time Machine?

    Hello, I have a computer that is getting s fresh clean install of Snow Leopard. I know how to go about doing this. However, I want to be able to transfer the files back using Time Machine. The Time Capsule has backups from 3 computers. How do I selec

  • IPhone thinks I am in Puerto Rico

    Live is states; visited Puerto Rico and now everything is in spanish.  Thinks I am still there.

  • Backing Up Page Changes to Desktop

    I want to be able to back up the page changes made through Contribute on to a desktop so my clients can have the latest edited pages and not depend on the hosting company as their only back up. Is this possible? Or, how is this usually handled? I kmo