Create a counter for the rows in a table using script editor?

Hi ,
I want to add afield in a particular table  with first field is its serial number . How to use scripting editor to fill the serial number ?
How to create a counter ?
Edited by: Rajan.Dexter9 on Jan 30, 2012 9:40 PM

Hello Rajan,
Create a field in the table and name it as 'SERIAL'.  Create a variable called 'count' with default value as 0.  Now in script editor, for javascript language and calculate event, write the following script.
var fields = xfa.layout.pageContent(xfa.layout.page(this)-1, "field", 0);
for (var i=0; i <= fields.length-1; i++)
     if (fields.item(i).name == "SERIAL")
          count.value = count.value + 1;
                 this.rawValue = count.value;     

Similar Messages

  • Counting all the rows in a table

    I've just come across what I think is a big oversight in the Power Query UI: it doesn't seem to be possible to find the total number of rows in a table using just the functionality available in the UI. I can do this very easily if I write my own expression
    using Table.RowCount(), but I would have expected to be able to do this through the UI. At the moment, when I go to the Group By dialog (which is where I'd expect to be able to do this) and delete all the columns in the Group By section the OK button gets
    greyed out. 
    Am I missing something here?
    Chris
    Check out my MS BI blog I also do
    SSAS, PowerPivot, MDX and DAX consultancy and run
    public SQL Server and BI training courses in the UK

    Hi Miguel,
    No, what I was talking about was to be able to use the Group By dialog and have no column to group by - that's to say, I'd just want to be able to count the number of rows in a table (or return the sum of all values in a column, or the min/max etc) and return
    a single value. I know I could do this by inserting an artificial column that only contains one distinct value, and using that in the Group By, or by writing my own expression that uses Table.RowCount(), but it seems like a very basic operation that should
    be easier to do in the UI.
    Chris
    Check out my MS BI blog I also do
    SSAS, PowerPivot, MDX and DAX consultancy
    and run public SQL Server and BI training courses in the UK

  • Question on Updating the rows of a table using a SELECT Statement

    Hi,
    I am trying to set all of the R_IDs in one table to the ID from another table using a join.
    Here is the SQL I came up with. I don't this is correct though.
    UPDATE TABLEA A
    SET R_ID=(Select Id from TABLEB B
    WHERE A.DEE=B.DEE AND
    B.RNUM=1);
    Does this make sense?

    You can try the join view.
    UPDATE ( SELECT table_a.id   AS a_id,
                    table_b.id   AS b_id,
                    table_a.col1 AS a_col1,
                    table_b.col1 AS b_col1,
                    table_a.col2 AS a_col2,
                    table_b.col2 AS b_col2,
                    table_a.col3 AS a_col3,
                    table_b.col3 AS b_col3
               FROM table_a,
                    table_b
              WHERE table_a.id = table_b.id)
       SET a_col1 = b_col1,
           a_col2 = b_col2,
           a_col3 = b_col3;
    However it may result in
    ORA-01779: cannot modify a column which maps to a non key-preserved tableThis is because the key-preserving property of a table does not depend on the actual data in the table. It is, rather, a property of its schema. For example, if in table_b there was at most one record for each id value, then table_a.id would be unique in the result of a join of table_a and table_b, but table_a would still not be a key-preserved table. By adding the unique/primary key on the id column of table_b we can assure that if table_b.id were part of the result set of the join view then it would be unique. This makes table_a key preserved.
    Thus, in order to update a join view we must assure that the columns involved in the join view from the source table are unique. We do this by creating a unique or primary key on those columns.
    However, if you do not mind taking responsibility for making sure that there is one-to-one cardinality between the source and destination rows, then you might try the correlated subquery
    UPDATE table_a
       SET (col1, col2, col3 ) =
              ( SELECT col1, col2, col3
                  FROM table_b
                 WHERE table_b.id = table_a.id )
           WHERE EXISTS
               ( SELECT col1, col2, col3
                   FROM table_b
                   WHERE table_b.id = table_a.id )

  • Select count(*) for each row of a table

    Hello All,
    Following query gives a statistics for each user (how many items he owns, home many tickets authored, how many objects he is subscribed to etc...)
    select auser.userid,
    (select count(*) from item where owner like '%' || auser.id || '%') ITEM_OWNER_CNT,
    (select count(*) from tkt where originator = auser.id) TKT_ORIGINATE_CNT,
    (select count(*) from tkt where assigned_to = auser.id) TKT_QA_CNT,
    (select count(*) from tkt where create_user = auser.id) TKT_AUTHOR_CNT,
    (select count(*) from subscriptions where subscriber_id = auser.id) SUBSCRIPTION_CNT
    from
    user auser
    I was not happy with the performance of this query, so I tried the same using group by. The performance was even worse.
    Is there any other option for me to try? Please advice.
    Thanks,
    Sathish

    Hi, Sathish,
    As SBH said, a lot depends on your data. Please post some sample data (CREATE TABLE adn INSERT statemetns) for all tables, and the results you want from that data. Describe and give examples of any relationships that are not one-to-one..
    You probably want to do joings, like SBH suggested, rather than scalar sub-queries.
    The connection between the auser and item tables
    (select count(*) from item where owner like '%' || auser.id || '%') ITEM_OWNER_CNT,is very suspicious. Perhaps the item table is poorly designed, and the query would be faster if that table were changed. Is changing the design of the item table an option?
    You should be able to get all the information from the tkt table in one pass. It looks like you need to unpivot the data, so instead of one row per ticket (with 3 different people connected to it), there are 3 rows per ticket, each with only 1 person referenced. This is not necessarily a bad table design. Unpivoting, even more than most other things, depends on your database version, so you'll have to tell what version of Oracle you're using.

  • What files to modify for the settings of Safari Prefs using plist editor ?

    I'm running into a situation that the default "Save downloaded files to"
    for some unknown reason has been changed to the hard disk top level of Desktop which caused all users can't download (permission error). I knew this can
    be fixed by the logged user by going to Safari's General Preference and change
    to the desired location. However, I need to use the "Property List Editor"
    to modify the preferences file(s) for all users ! as I have a customized
    /System/Library/User\ Template/English.lproj which contains a Safari folder
    under /System/Library/user\ template/English.lproj/Library. There is file called "Downloads.plist" under the Safari folder, I examined this file using
    "Property List Editor", it contains the following two lines:
    <key>DownloadEntryPath</key>
    <string>~/Desktop/fdmacosx.sit</string>
    I am not sure if the above two entries are for the "Save downloaded files to"
    setting in Safari GUI Preferences setting. If they are, then they should point
    to the logged user's home directory's Desktop (Not points to the drive top level)which should be correct. BUT all subsequent created users STILL point to the drive top level Desktop (with Red stop sign in the icon)in Safari's Preferences.
    I also looked in the /System/Library/user\ template/English.lproj/Library/Preferences/com.apple.Safari.plist, nothing related to the "Save downloaded files to".
    Where to look for the Preferences file(s) for this setting ?
    DC

    Found nothing related to the "Save downloaded files to" preferences setting
    in ~/Library/Preferences/com.apple.Safari.plist. what is the entry in
    ~/Library/Preferences/com.apple.Safari.plist ? Should not be in the logged user
    Preferences file, I'm looking for system wide plist file.
    -DC

  • How do i create a Count for the no. of images displayed on stage

    i am a total newbie in flash ! & currently making a simple mcq quiz.
    each stage will have three choices of answers (A/B/C)
    every correct answers will be displayed an image :
    var myQ1a:URLRequest=new URLRequest("tick.png");
    in the end, how can i count the number of images displayed in the overall flash and display it.
    or.. perhaps you have other options on how can i display the scores.

    Hi.
    here's my code :
    stop();
    aa1.addEventListener(MouseEvent.CLICK, ona1Click);
    bb1.addEventListener(MouseEvent.CLICK, onb1Click);
    cc1.addEventListener(MouseEvent.CLICK, onc1Click);
    next1.addEventListener(MouseEvent.CLICK, onNext1Click);
    home1.addEventListener(MouseEvent.CLICK, onHome1Click);
    var Q1a:Loader;
    var Q1b:Loader;
    var Q1c:Loader;
    var Q1next:Loader = new Loader();
    var Q1home:Loader = new Loader();
    //the name of the function has to match what you're calling from the event listener
    function ona1Click(evt:MouseEvent):void {
    Q1a = new Loader();
    bb1.removeEventListener(MouseEvent.CLICK, onb1Click);
    cc1.removeEventListener(MouseEvent.CLICK, onc1Click);
    var myQ1a:URLRequest=new URLRequest("wrong.png");
    Q1a.load(myQ1a);
    addChild(Q1a);
    Q1a.x=320;
    Q1a.y=180;
    function onb1Click(evt:MouseEvent):void {
    Q1b = new Loader();
    aa1.removeEventListener(MouseEvent.CLICK, ona1Click);
    cc1.removeEventListener(MouseEvent.CLICK, onc1Click);
    var myQ1b:URLRequest=new URLRequest("tick.png");
    Q1b.load(myQ1b);
    addChild(Q1b);
    Q1b.x=320;
    Q1b.y=260;
    function onc1Click(evt:MouseEvent):void {
    Q1c = new Loader();
    aa1.removeEventListener(MouseEvent.CLICK, ona1Click);
    bb1.removeEventListener(MouseEvent.CLICK, onb1Click);
    var myQ1c:URLRequest=new URLRequest("wrong.png");
    Q1c.load(myQ1c);
    addChild(Q1c);
    Q1c.x=320;
    Q1c.y=340;
    //next1.addEventListener(MouseEvent.CLICK, onNext1Click);
    function onNext1Click(evt:MouseEvent):void {
    if(Q1a)
    removeChild(Q1a);
    if (Q1b)
    removeChild(Q1b);
    if(Q1c)
    removeChild(Q1c);
    gotoAndPlay(2);
    //home1.addEventListener(MouseEvent.CLICK, onHome1Click);
    function onHome1Click(evt:MouseEvent):void {
    gotoAndPlay(17);
    this code is on the 1st frame. this will go on till the 15th frame. i wonder where i can put the codes you've given me ..

  • Get the Count for each row

    I'm trying to get the count for each row to total count for each month
    Something like this
    Hardware     |      Jan
    Monitors       |       5
    Processors   |      137
    Printers        |      57
    etc........
    How can I write a query for this. I can get the Hardware column but don't know how to get the next column.

    If you can provide more data like sample input DML statements it would have been wonderful..
    Assuming is , you need a pivot. Here is an article on basic Pivot..
    http://sqlsaga.com/sql-server/how-to-use-pivot-to-transform-rows-into-columns-in-sql-server/
    something like this may be..
    DECLARE @Input TABLE
    Hardware VARCHAR(20),
    [Date] VARCHAR(20)
    INSERT INTO @Input VALUES('Monitor', '01/01/2014'), ('CPU', '01/01/2014'), ('Monitor', '01/03/2014')
    , ('ABC', '01/01/2014'),('Monitor', '02/01/2014')
    ;WITH CTE AS
    SELECT Hardware, LEFT(DATENAME(M, [Date]),3) AS [MonthName] FROM @Input
    SELECT *
    FROM
    SELECT Hardware, [MonthName], COUNT(Hardware) AS Count FROM CTE GROUP BY Hardware, [MonthName]) a
    PIVOT (MAX([Count]) FOR [MonthName] IN ([Jan], [Feb])) pvt
    Please mark as answer, if this has helped you solve the issue.
    Good Luck :) .. visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles.

  • How to determine count for the number of rows

    Appreciate if any of you could think of a way of determining the count for the number of rows in the subquery without having to run another query.
    SELECT *FROM
    (SELECT rownum, rn, rlp_id, rlp_notes, cad_pid, status, jurisdiction_id, s.state_abbr, rlp_address, rlp_route_id, rlp_route_section, psma_version FROM ipod.relevant_land_parcels r, state s WHERE s.state_pid = r.state_pid(+) AND rlp_route_id = 'SM1' AND status = 'CURRENT')WHERE rn > 200 AND rn < 216
    And I want to import this into.net and C# environment.

    Something like this,.....????
    SQL> select * from emp;
    EMPNO ENAME      JOB         MGR HIREDATE          SAL      COMM DEPTNO
    7369 SMITH      CLERK      7902 17/12/1980     800,00               20
    7499 ALLEN      SALESMAN   7698 20/02/1981    1600,00    300,00     30
    7521 WARD       SALESMAN   7698 22/02/1981    1250,00    500,00     30
    7566 JONES      MANAGER    7839 02/04/1981    2975,00               20
    7654 MARTIN     SALESMAN   7698 28/09/1981    1250,00   1400,00     30
    7698 BLAKE      MANAGER    7839 01/05/1981    2850,00               30
    7782 CLARK      MANAGER    7839 09/06/1981    2450,00               10
    7788 SCOTT      ANALYST    7566 19/04/1987    3000,00               20
    7839 KING       PRESIDENT       17/11/1981    5000,00               10
    7844 TURNER     SALESMAN   7698 08/09/1981    1500,00      0,00     30
    7876 ADAMS      CLERK      7788 23/05/1987    1100,00               20
    7900 JAMES      CLERK      7698 03/12/1981     950,00               30
    7902 FORD       ANALYST    7566 03/12/1981    3000,00               20
    7934 MILLER     CLERK      7782 23/01/1982    1300,00               10
    14 rows selected
    SQL>
    SQL> select max(rw) from
    2 (
    3 select empno , row_number () over (order by empno) rw from emp
    4 where job='CLERK'
    5 )
    6 /
       MAX(RW)
             4Greetings...
    Sim

  • Save Query - An error occurred while creating connection strings for the query

    A workbook trying to edit and reload I get the following error "Save Query - An error occurred while creating connection strings for the query" No Power Pivot data model or anything.

    I am getting the same error when editing a Power Query in an Excel spreadsheet. It happens when I change a Group By step to do a Sum instead of Count Rows.

  • Procudure to count all the rows in a all tables in the schema

    When I run the following store procedure to count all the rows in all the tables I crash my sql Plus editor:
    CREATE OR REPLACE PROCEDURE TC_TABLEROWCOUNT(OWNER IN varchar2)
    IS
    row_count number;
    cursor get_tab is
    select table_name, num_rows
    from all_tables
    where owner='MAXDEV';
    begin
    dbms_output.put_line('Checking Record Counts for schema maxdev ');
    FOR get_tab_rec IN get_tab LOOP
         BEGIN
              EXECUTE IMMEDIATE 'select count(*) from '||get_tab_rec.table_name
              INTO row_count;
              EXCEPTION WHEN OTHERS THEN
                        dbms_output.put_line('Error counting rows for table '
                                                 ||get_tab_rec.table_name);
         END;
    END LOOP;
    END;
    What am I doing wrong.
    Thanks for any help Tony

    The boss gave me 5 pages of tables and wants to know how many row there are in each table. There is a problem of one DB being out of sync with another.
    But I have managed to work the problem though.
    here is the working code:
    CREATE OR REPLACE PROCEDURE TC_TABLEROWCOUNT (
    TableOwner IN varchar2)
    IS
    row_count number;
    vTable varchar2(30);
    v_sqlstmt varchar2(100);
    cursor get_tab is
    select table_name, num_rows
    from all_tables
    where owner = TableOwner;
    begin
    dbms_output.put_line('Checking Record Counts for schema maxdev ');
    FOR get_tab_rec IN get_tab LOOP
    vTable := get_tab_rec.table_name;
    v_sqlstmt := 'SELECT count(*) from '||vTable;
    EXECUTE IMMEDIATE v_sqlstmt into row_count;
    dbms_output.put_line('Table '|| get_tab_rec.table_name || ' Row ' || row_count);
    END LOOP;
    END;

  • Creating Named lov for each row..........

    How to create Named LOV for each row in a field.
    i have a tabular in a page. In that tabular i have three fields service_code,*service_name* and No_units.
    i have to create lov for service_code for all rows.
    how to do this?
    plz help...

    Hi Frank,
    This is the method i wrote in the managed Bean. It works when I hard code the department value to some value(like 10).
    public List<SelectItem> getEmployeeList() {
    int Deptid = 10;
    ArrayList<SelectItem> employees = new ArrayList<SelectItem>();
    employees.add(new SelectItem("0", "--Select Employee---"));
    try {
    Connection con = getConnection();
    PreparedStatement ps =
    con.prepareStatement("select name from employees where department_id = ?");
    ps.setInt(1, Deptid);
    ResultSet rs = ps.executeQuery();
    while (rs.next()) {
    employees.add(new SelectItem(rs.getString("name")));
    rs.close();
    ps.close();
    con.close();
    } catch (Exception ex) {
    System.out.println(ex.getMessage());
    return employees;
    How can I pass the row Department Id to this method in the f:selectItems?
    I really appreciate your help in resolving this issue.
    Thanks

  • HT5622 We are a family of 4, each with their own apple device. Is it best for us to set up individual apple ID's for things like ITunes? If we do can the same e-mail address be used for all of them or do we need to create e-mails for the kids? Thank-you

    We are a family of 4, each with their own apple device. Is it best for us to set up individual apple ID's for things like ITunes? If we do can the same e-mail address be used for all of them or do we need to create e-mails for the kids?
    Thank-you

    1. Yes, it is.
    2. You may be able to use the same address by adding a plussed suffix to it, such as [email protected] If that doesn't work, create separate emails.
    (103279)

  • Creating portal desktop for the user

    Hi All-
    Please help me out...
    1) Could you let me know the detailed procedure ( if possible please provide screen shots) to create "Portal Desktop for the user".
    2)Suppose we developed a webDynpro Application and we need to make it Role Based access....please let me how to achieve this..
    3)Help me out in creation of "Roles" in Portal Content Development and the steps to assign pages to "Roles"
    Regards,
    Cris

    Hi Cris,
    Follow these links for the required info.
    Creating Portal Desktop for specific user
    Portal Branding for specific user
    Creating Roles & worksets
    http://help.sap.com/saphelp_nw04/helpdata/en/4f/bceaffeb8c114ebef8255b63079c7c/frameset.htm
    Integrating webdynpro in portal
    https://www.sdn.sap.com/irj/sdn/downloaditem?rid=/library/uuid/2fffe990-0201-0010-aab0-e61c3250bcf3
    Hope I am helpful.
    Cheers,
    Santhosh

  • What is the keyboard shortcut for "delete row" in a table?

    What is the keyboard shortcut for "delete row" in a table within a pages document?

    Click on the row number to select the entire row. Right-click, and select Delete Row from the menu. There is no keyboard shortcut.

  • Can we create two POs for the same 3rd party Sales Order?

    Hi MM experts,
    Issue: Can we create two POs for the same 3rd party Sales Order
    In Third party purchase process, first sales order created with a spl. item category  and it creates the PR automatically with the Sales order material and Qty and this PR converted PO.
    They got a pur.req. for sale order on same item for same delevery date. They did not get any warning msg. saying that a PO was prviously placed against this sale order.
    How it is possible that we were able to place another PO? concern is that second PO was palced against SO which was already used & completed. they were able to place 2 POs for the same customer same delevery date. How it is possible?
    If anyone face the same issue, please let me know if you have any answer to this questions.
    Thanks in advance.
    Suresh.

    Suresh,
    It is hard for me to give you a definitive answer since you have created a customized solution.
    How it is possible that we were able to place another PO? concern is that second PO was palced against SO which was already used & completed. they were able to place 2 POs for the same customer same delevery date. How it is possible?
    Normally, the system will not do this.  A third party PR or PO will be 'account assigned' to the Sales order.  SAP standard 3rd party will not create additional purchase reqs unless there has been manual intervention.  Try searching for changes in the Sales order and changes in the original purchase order.  They may give you a clue.
    I believe the normal Item category for third party SO is TAS (I am working from memory here, I am not in front of a system).  I don't know what ZTAG does.  I confess I am not an SD expert.  You might also want to post your question in an SD forum.
    You mention two custom applications, ZMMPLAN and ZSTPMP.  These somehow have functionality that is used to help you convert your PRs to POs.  If I were in your position, I believe I would also look at these applications for clues to how they might be contributing to your problem.  And please don't send me details about these apps.  I will not comment on custom code in this forum.
    Sorry I can't be of more help.
    Rgds,
    DB49

Maybe you are looking for

  • Siri not working on iPad mini on iSO 6.1.3

    Hi, I updated my software for my  iPad mini to iSO 6.1.3 and Siri doesn't work.  When I hold the home button Siri comes up and when I say something nothing happens. Under general i have Siri on, language as English, voice feedback always, privacy set

  • Problem with customised subscreen in ME21N

    I am using BadI ME_GUI_PO_CUST  & ME_PROCESS_PO_CUST to add a customized subscreen in the header. But the subscreen is only visible with ME23N & ME22N not with ME21N . I am new to BadI, so help is needed. I have used the following code: In BadI ME_GU

  • How to send a conditional email with interactive report subscription

    Hi, i have an interactive report with subscription. I would like to send an email with the attachment only when the query returns one or more records. How to to this? Apex 4.0.2 Thanks in advance lukx

  • Process chain for a particular selection profile

    Hi, How can I create a process chain in DP to run only for selected selection profiles?

  • Thumbnail and Click to Play

    Hello everyone and thanks for your help in advance.  I am a total newbie to creating Flash movies.  I have created video stock that can be played in the flash player, and now want to create an effect similar to the vidoe located at: http://www.thefir