Calculate Row Number - Auto Increment

I think I know what I want to do, I just don't know how to do it.
I have a form which has rows that can be added or deleted as the user requires. The first column in the row is a control number which has some static text and a number starting at 001 that I want to add to or subtract from based on the users action of clicking on the add or delete button.
The way I figured this would work was to place the number 1 in a hidden field on the form and att 1 to it each time the add button was pressed and/or delete 1 each time the delete button was pressed. The numbers in the remaining rows would need to be recalculated each time to ensure they are sequentially correct..
Could anyone point me in the right direction on how to accomplish this?
Thanks in advance for your replies. E

Easier than that, use the "index" property in the calculate event of the field you want to number:
$ = (concat("some_static_text", (Table1.Row1.index + 1)))
Also regarding the hidden field, luckily this case has a property you can use already. But if you need to maintain a counter outside of your table, use a variable instead of a hidden field.
Either add "var myVariable = null" to the initialize event of the table's subform (for a local variable) or else create a global variable in the form's properties: File > Form Properties > Variables tab.
Either way, you can pass things to and from the variable for use in your scripts.

Similar Messages

  • Retrieve new row's auto-increment key from dataprovider

    ** cross posted on SDN JSC Forum and Netbeans J2EE Nabble forum **
    I have a page that is bound to a MySQL table rowset or, alternately, a new (append()'ed) row. The row's Primary Key is a MySQL auto-increment Integer (translates to a Long.) After commit()'ing the the new row to the database, how would I then get the new row's ID (fieldname "ID")? If I refresh() the dataprovider and try to get the value an error is thrown.
    Some background: The dataprovider's backing rowset has a query parameter for the ID field. I set it to "0" if the page is creating a new row or I set it to the unique ID if the page is displaying an existing row. After the new row is committed, I need the new ID set the query parameter and synch up related rows in different tables that are keyed off the ID in this (master) table. I'd like to do this without "guessing" what the ID would be in advance as that method isn't foolproof in heavy usage.
    Additionally, it strikes me as a useful workaround if the unique ID was a UUID (mySQL UUID() function) that does not run the risk of any concurrency issues. Has anyone used this solution in VWP? How would I make the call for the underying DB (in this case MySQL, but could be anything) to generate the UUID? Is the call DB specific or is there a JDBC equivalent?
    UPDATE: never mind the GUID question, I can use the java.rmi.dgc.VMID class to autogenerate unique GUID's for this purpose. Being from a Lotus Notes background, I'm used to the power and flexibility such Unique ID's bring to the app. dev's portfolio.
    Thanks in adv. for any help .
    -Jake
    Message was edited by:
    jakeochs

    JSF together with JBoss Seam offers some real good possibilities to improve developer productivity. Right now, with JSF you can create forms where fields are persistent (saved in a database), but you have to write code to persist fields. In Notes/Domino, every field you drop in the form is automatically set to persist without writing a single piece of code. JBoss Seam aims to provide the missing glue to tie the JSF beans with business logic (EJB) and persistent layer (JPA). I think tools for Seam are still not mature. I would love to see JSC/VWB utilizing Seam. I know there is a NetBean plugin for Seam but it was written for old NetBeans (not VWP or JSC), so it doesn't work with the visual web pack where you can drag and drop JSF components.

  • How do I select a field and between selected rows insert auto-incremented numbers?

    I have a spreadsheet in Numbers '09 and I want to number the rows so that I can sort by the original order after I've already sorted by different items. In Excel this is fairly easy, but how do you do this in Numbers? How do I select a series of rows in a column and tell it to automatically insert numbers incremented from one to the total number of rows?
    Thanks,
    Philip

    Hi Philip,
    As an alternative to the method Yvan pointed out, you could use a formula.
    (NOTE: This takes longer to write than to do.
    (CAUTION: Make sure you use Copy/Paste Values to replace the formulas with the calculated numbers before sorting.))
    Choose a column in which to place the numbers.
    In the first non-header cell in the column enter the formula:
       =ROW()
    Select the whole column by clicking its column reference tab.
    Then use command-click to deselect the header cells above the one where you placed the formula.
    With the cell containing the formula and all of the column below it selected, go:
       Insert (menu) > Fill > Fill Down
    The formula will be filled into the rest of the column and the numbers calculated.
    With the cells still selected, COPY, then go Edit > Paste Values.
    This replaces the 'live' formulas with the numbers themselves, and prevents the numbers being recalculated when the rows are sorted.
    Regards,
    Barry

  • 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));

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

  • 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

  • Auto increment row no. of a datatable

    I want the first column of a datatable to show the serial no. of each row, like 1, 2, 3... with the column header "Id". Is there any way to implement this without modifying my bean? Is there any mechanism which has implemneted the auto increment function?

    Access the datamodel and do that

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

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

  • 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

  • Is it possible to auto increment a number in share point list ?

    hello,
    is it possible to generate an auto increment field in share point list?
    for example,  there are two fields [auto increment id] and [title]
    lets say i create title as 'Steve' ; it will  automate auto increment field  with value 1 
    next , i insert title 'Paul' it ll populate the auto increment field with value 2.
    thanks,
    Jay

    Hi Jay,
    You can use the Item Id field of the SharePoint list which will get incremented by 1 whenever you add the new item.
    you can refer the below threads for other options of auto increment id
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/134fd5f6-17ce-4044-a78e-e7a32b523190/creating-autoincrement-field-in-sharepoint-list?forum=sharepointgeneralprevious
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/39743bb3-872d-4788-96a8-2b9fb8813011/create-auto-increment-value-in-sharepoint-column?forum=sharepointgeneralprevious
    My Blog- http://www.sharepoint-journey.com| Twitter
    If a post answers your question, please click "Mark As Answer" on that post and "Vote as Helpful

  • How to use auto-increment and search option for MS Access DB

    Dear All,
               I have configured our invoice in Adobe Livecycle and connected it to MS Acess 2007 as per http://forms.stefcameron.com/2006/09/18/connecting-a-form-to-a-database/.
    All is working fine, I can insert, retrieve data from DB to invoice and vice versa.
    Now I want few things to be implemented on our invoice.
    When ever I open our invoice, it populate the first entry from DB, Is it possible to populate the last entry ?
    Auto increment invoice number from MS Access DB every time we open our invoice after save.
    How to implement search option from DB for invoice number ?
    Please let me know if someone can provide me help on my scenario, so that I can share more stuff related to invoice and DB.
    Look forward to hearing soon from experts and other team members.
    Thanks & Regards
    Riyad...

    As far as I know there is not any auto increment data type in Oracle. Instead of this you should create a sequence and get the next value of the sequence while creating a row in your table.
    CREATE SEQUENCE Test_Sequence ;
    CREATE TABLE Test_Table ( Id NUMBER , Foo VARCHAR2(4) ) ;
    ALTER TABLE Test_Table ADD CONSTRAINT Test_Table_PK_Id PRIMARY KEY ( Id ) ;
    INSERT INTO Test_Table ( Id , Information ) VALUES ( Test_Sequence.NEXTVAL , 'FOO' ) ;

  • How can i create an auto increment column

    Hello Everyone
    We are working on an EAM package which has an auto number facility but that is not meeting our requirement because some 10s and 100s of numbers keep on jumping based on the number of records the child table has.Means every record in my parent table will have some child records in another table which we call it a child table.The number of numbers that will be jumped each time will depend on the number of child records it has. Now we want to create a new column and generate a sequential unique number in my parent table with out linking it to its child table and use this number as a reference number. And we cant do that through our package customization. Can any one guide us if we can meet our requirement through oracle triggers or so.
    Thanks and Regards

    Hi,
    For "Auto-Increment" functionality - you can use a combination of a sequence and a trigger like so:
    create table roles ( role_id INT
                       , role_name VARCHAR2(30) NOT NULL
                       , creation_date DATE DEFAULT SYSDATE NOT NULL
                       , role_description VARCHAR2(255)
                       , CONSTRAINT roles_pk PRIMARY KEY (role_id)
                       , CONSTRAINT roles_uk1 UNIQUE (role_name)
    create sequence role_id_seq
    start with 1
    increment by 1
    nocache;
    CREATE OR REPLACE TRIGGER roles_pk_trig
    BEFORE
    insert on roles
    for each row
    begin
    IF :new.role_id IS NULL THEN
       SELECT role_id_seq.NEXTVAL
       INTO :new.role_id
       FROM dual;
    END IF;
    end;
    /Now any insert which leaves the "ROLE_ID" column NULL will have an auto-incremented value put in for that column. This is similar to an "Autonumber" column in Access.
    Hope this helps...
    Take care.

  • How to use "Auto increment" in temp table Oracle

    Pleas tell me yaar,
    In MS Sql for Auto increment i am using like this "seqid int identity" for temp table
    t_seq_tbl table(seqid int identity,EVENT_SEQ_NO varchar(30))
    In oracle how to use....

    As far as I know there is not any auto increment data type in Oracle. Instead of this you should create a sequence and get the next value of the sequence while creating a row in your table.
    CREATE SEQUENCE Test_Sequence ;
    CREATE TABLE Test_Table ( Id NUMBER , Foo VARCHAR2(4) ) ;
    ALTER TABLE Test_Table ADD CONSTRAINT Test_Table_PK_Id PRIMARY KEY ( Id ) ;
    INSERT INTO Test_Table ( Id , Information ) VALUES ( Test_Sequence.NEXTVAL , 'FOO' ) ;

Maybe you are looking for

  • How do i upload a video (dvd) to my mac?

    I have a cd of a live performance of mine that I'm trying to save to my computer, however I can't figure out how to burn the disc on to my mac.

  • MacBook and Mac mini togheter?

    Hi everyone... I'm the proud owner of a MacBook but I'm studying Computer Engeneering and my MacBook is becoming slower and slower.. So my question is if I'm able to use Mac mini conected to my MacBook using it as a screen. Thanks for your answer!!

  • Ipod touch not recognized by windows 7

    Hello, I know this is a commonly asked issue on these forums. So I will be as thorough as possible. I am using an ipod touch first gen running iOS 3.0. I am trying to sync it up to my computer which is running windows 7 profession service pack 1. I h

  • Hyperion Shared Services and DB Userid

    Hi, When we create a DB userid for Hyperiion Shared services, do we need to tie this userid to a separate tablespace (like hss_data and hss_index). Thanks

  • PRCT-1302 : The "OCR," has an invalid IP address format

    Dear RAC experts, I am setting up RAC nodes and during installation it fails with error PRCT-1302. PRCT-01302: The "{0}" has an invalid IP address format Cause: The format of the subnet number and/or the subnet mask is an invalid IP address format.