Database add row

Hi all,
I have a real simple question regarding the database module in LabVIEW.  All I want to do is to find out the max value in column 1, which would be located in the last row of the column, and add another row beneath the last row and have have pervious max + 1 as its value. 
How do you do this with the two approaches below?
Approach 1.
1. move the cursor to the last row.
2. read the last row and get its max
3. add a new row below the previous last row with new max.
Approach 2.
1. Do SQL query to get the max on column 1
2. add a new row below the previous last row with new max.
Thanks!
Yik
Kudos and Accepted as Solution are welcome!

jyang72211 wrote:
I have a real simple question regarding the database module in LabVIEW.  All I want to do is to find out the max value in column 1, which would be located in the last row of the column, and add another row beneath the last row and have have pervious max + 1 as its value.
That's something you can never really be certain of when it comes to databases, it's also not an issue. In which order the database stores data is completely irrelevant, if you need it in any particular order you use 'Order by'.
As for the solution, i'd also go for version 2, unless you can change the database to autoincrement, as mentioned.
/Y
LabVIEW 8.2 - 2014
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
G# - Free award winning reference based OOP for LV

Similar Messages

  • Want to add rows from database in custom table model

    Hello all,
    I have written custom table model which has single blank row intially.
    Once user clicks on button, i want to add more rows in custom table model and display them in JTable.
    I have created JTable object as shown below.
    Jtable patientTable = new JTable( new DiagnosticTableModel());
    My custom tabel model is as shown below.
    import javax.swing.table.AbstractTableModel;
    public class DiagnosticTableModel extends AbstractTableModel
         private String[] columnNames = {
                         "Date",
                                              "Diagnosis",
                                              "Severity",
                                              "Medications"};
         private String[][] data = {
          public int getColumnCount()
             return columnNames.length;
          public int getRowCount()
               return data.length;
          public String getColumnName(int col)
             return columnNames[col];
          public Class getColumnClass(int col)
             return getValueAt(0, col).getClass();
          public Object getValueAt(int row, int col)
             return data[row][col];
          public boolean isCellEditable(int row, int col)
          return true;
          public void setValueAt(Object value, int row, int col)
             data[row][col] = value.toString();
             fireTableCellUpdated(row, col);
    }Thanx a lot in advance.

    I have written custom table model which has single blank row intially.Why did you write a custom TableModel? The DefaultTableModel will work fine and it has methods that allow you to dynamically add rows to the table.

  • How can i add rows in a tabular form

    Hi,
    How can i add rows in a tabular form with out updating in database and after adding the rows one by one and after filling the data then iwant to submit them all at once.Please help me on this.
    Thanks

    Hello Leandro,
    In the Add_Rows page process, there is a box for "Number Of Rows". Change that value and you change the number of rows that get added. The default is 1.
    Don.
    You can reward this reply by marking it as either Helpful or Correct :)

  • Problem in add row button in apex3.2

    Hi All,
    I have a requirement in tabular form in apex3.2 in which when i click the add row button the add row function is working and 1 row is loaded. again when i click the add row button it should load multiple rows according to my number of click. This condition is working in apex 4.1 but not in 3.2.
    With Regards
    Wildfire;;;

    apex 3.2 is different to 4.1, because in 4.1 it adds the rows on the fly without submitting the page.
    But in 3.2 it submits the page and adds the new row, when submitting the page it adds any newly entered row into database and adds a blank row.
    But in your scenario you are adding a blank row and not populating the values and clicking the add row to get another blank row, Which will try to post the existing blank row into database and adds new row(so you loose the first blank row)
    I guess there was an option in (button or process) 3.2 to specify the number of blank rows you want.
    Thanks

  • Issue with empty value of LOV of first row after clicking on add row button

    JDeveloper 11.1.14
    I have a page with table-form layout.
    In the form I have two detail tables on the same page (tabbed).
    I have an issue with using model-choicelist LOV's in the detail tables.
    I am able to add a new row in the detail table, select a value from the model-choiceList LOV (which is required) and save the new row.
    After adding another row in this table the value of the model-choiceList LOV in the previous row is suddenly empty on the screen. It is not empty in the database,
    I have checked it in the datbase. Only the value of the LOV of the first row on the page is being cleared after clicking on the add row button.
    After saving the new row I get the following error on the screen:
    Error: a selection is required. --> first row
    Does anyone have a suggestion how to solve this issue?

    After adding another row in this table the value of the model-choiceList LOV in the previous row is suddenly empty on the screen. It is not empty in the database, Is the complete LOV blank or only the selected value .. can you try putting autoSubmit=true in the LOV and try ? Also check if you have any partialTriggers on the LOV from the add button ?

  • Is there a way to add rows to a table in a fillable PDF?

    I have created a fillable form, but the table I've created only has 9 rows. I'd like to be able to expand the rows on demand. If they're needed, then the user could add rows to the table as needed. It's an expense form, so the rows need to be there when there are multiple expenses, but not there when there are only a few expenses. Any/all help is appreciated. Thanks!

    here's more background infomation... I have some audits setup on my database for one of my users. Every quarter I have an automated job that runs that creates a usage/statics report for this person using data in aud$. at the end of the job I export the aud$ table and truncate it. However last quarter I found that there was a mistake in my report and my export did not run properly thus my audit data was gone. i also have full datapump exports that run daily but found that aud$ was not there. so that is why I thought I'd like to include sys.aud$ in the full datapump exports.
    i understand why other sys tables would be left out of a full export but aud$ data cannot be reproduced so to me it makes sense to include it in a full export.
    don't worry, we run our true backups using rman which is eventually how I got the aud$ data back by creating a copy of my database up until the time of the truncate. however this was quite time consuming.

  • Add row in block

    can i add row in block at runtime?
    i m using oracle forms 10g
    database oracle 10g
    regards
    Rupal

    hi
    I understand the above answer.
    But can you please explain me at what kind of situations , you need this options
    Thanks

  • How to add rows using DefaultTableModel?

    I'm trying to figure out the ins-and-outs of creating a dynamic table.
    I looked for a tutorial, but none of the example programs I found dealt with my particular issue, nor did they explain anything.
    For instance, most of the examples looked like this:
            table = new JTable();
            defaultModel = new DefaultTableModel(10,5);
            setModel(defaultModel);But that doesn't work for me -- I'm creating a class that EXTENDS DefaultTableModel, and so if I want to send in parameters, I have a problem.
              public MyTableModel() {
                            super(data, columnNames);
                    ...The above code complains that "you can't access data or columnNames until you call super()!"
    But I've seen plenty of example code that DOES send in parameters to super(). How do they get away with that? Is it because they are parameters to the constructor, whereas private/public members of the class are somehow different?
    I thought a variable is a variable -- why is one allowed but not the other?
    Lastly, I'm trying to figure out, practically speaking, how to load a database with X items, and be able to add rows later. Does that mean I need to use a vector for my data instead of Object[][]?
    I've seen BOTH AbstractDataModel and DefaultTableModel used with dynamic tables -- is there any difference between them as far as dynamic tables are concerned?
    I was under the impression that I needed to "switch" from ADM to DTM if I wanted to be able to add rows to my table at runtime.
    Here are some references to previous discussions I found/participated in on this topic:
    http://forum.java.sun.com/thread.jspa?threadID=5224966
    http://forum.java.sun.com/thread.jspa?threadID=439141&start=0&tstart=0
    Thanks in advance for any help,
    Matthew

    -> I'm creating a class that EXTENDS DefaultTableModel, and so if I want to send in parameters, I have a problem
    Well, you would pass in the data and columnNames as parameter when you create your table model.
    -> Lastly, I'm trying to figure out, practically speaking, how to load a
    -> database with X items, and be able to add rows later. Does that
    -> mean I need to use a vector for my data instead of Object[][]?
    You just said you extended DefaultTableModel. Well you don't need to do anything it already manages the data for you. You just use the methods provided to update and change the data.
    -> I've seen BOTH AbstractDataModel and DefaultTableModel used with dynamic tables
    No you haven't. You really don't understand what an AbstractDataModel is do you? Its nothing. You can't use it. It doesn't have any storage for the data, and since there is no data storage you can't access the data or change it. You can't even create an AbstractTableModel. Read your Java text on what an Abstract class it.
    The DefaultTableModel extends the AbstractTableModel to provide data storage and ways to get the data and change the data. It notifies the table when any change is made to the data so the table can repaint itself.
    -> How to add rows using DefaultTableModel?
    Finally, the DTM provides methods that make the model dynamic. Methods for adding and removing rows or adding and removing columns. Read the API for more information.
    If you still don't understand how how the methods work then search the forum for examples that use the methods you don't understand. I've posted an example the uses the methods required to add rows or columns.

  • Behavior of ADD ROW button (v 2.0)

    Hi,
    I have a tabular SQL report form with 4 buttons: cancel, add row, submit, delete.
    I come to the screen with no records, execute a query. After that I need to perform insert.
    I press <ADD ROW> button, and correctly have one empty record for my possession. (in the process definition I have only 1 record to add.) I put some data into this row; and without the submitting I add another row by pressing <ADD ROW> button once more. And what happens? HTMLDB saves my 1st record and add another empty one! Is it expected behavior, that is what supposed to be? How to avoid it, not allow to save that recored (because in this case it by pass all my validations and insert a bad data) or at least alert the user that what is going to be?
    Please, help.
    Thanks,
    Jenny.

    Vikas,
    I've made some tests:
    1. ADD button does not add a new record when there are not rows on the screen
    2. if there is a row with invalid data (some mandatory fields are null) it does validations, it works, on the old record, which is on the screen.
    3. after submitting correct record (commit was perfomed), add button gives
    " Error in mru internal routine: ORA-20001: Error in MRU: row= 1, ORA-20001: ORA-20001: Current version of data in database has changed since user initiated update process"
    I my old posting Re: Error handling on Tabular form you created a sample appl to test that null validation function foo() which I'm using now for this process. Can you try ADD button also in that sample appl of yours?
    I tried all these possibilities. So far, they do not work for me.
    Thanks,
    Jenny.

  • Flex Table Add Row Issue with Dynamic Entry Lists in Visual Composer

    All,
    Your help would be kindly appreciated in resolving an 'Add Row'-issue within a Flex Table that uses Dynamic Entry Lists in Visual Composer. The issue here is as follows :
    When I use a [Local Dynamic Entry List |http://www.postyourimage.com/view_image.php?img_id=O5hrG2aMxWZ84Mu1211193041]to populate a row field, the initial row and all next rows are emptied upon 'insert row', they loose their selected values and also the entry list values ('pull-down menus') are lost. Please also see [screenshot|http://www.postyourimage.com/view_image.php?img_id=FPLr2cABcgiHRou1211192889].
    The initial row does [show the entry list values |http://www.postyourimage.com/view_image.php?img_id=2HybmEHAuQYs9cg1211192766]from the Local Dynamic Entry List based on the dynamically assigned input value; upon 'insert row' the entry lists are lost. Please also see [screenshot|http://www.postyourimage.com/view_image.php?img_id=FPLr2cABcgiHRou1211192889].
    When using a [Global Dynamic Entry List |http://www.postyourimage.com/view_image.php?img_id=m5p2KYuBb442dTq1211193501]to populate the row fields the Flex-table behaves normally as expected. Unfortunately with a Global Entry List it is not possible to dynamically assign a input value. Please also see [screenshot|http://www.postyourimage.com/view_image.php?img_id=U96V0zENCCyO3gA1211193157].
    Please also see the [issue summary image|http://www.postyourimage.com/view_image.php?img_id=06xti08tIEfely1211195178] I made to visualize the issue.  What I basically would like to know is whether this is a 'known issue' or not, or that it is an issue that can be fixed or whether there is an alternative workaround available ... I'm using Visual Composer 7.0 and the Portal is at SP 13.
    Many thanks,
    Freek

    Hi,
    you should be able to assign a dynamic value with global entry lists as well. If you say @myParam as dynamic value. VC will indicate in red letters, that the field @myParam is unknown. However, it will work, as long as @myParam is known in the form or table where you use the entry list.
    I have never heard of the problem that entry lists are emptied after "insert"-event.
    Kindes Regards,
    Benni

  • Missing functionality.Draw document wizard - delete/add rows and copy/paste

    Scenario:
    My customer is using 2007 SP0 PL47 and would like the ability to change the sequence of the rows of the draw document wizard and delete/add multiple rows (i.e. when you create an AR Invoice copied from several deliveries).
    This customer requires the sequence of items on the AR invoice to be consistent with the sequence on the original sales order including text lines and subtotals. Currently we cannot achieve this when there are multiple deliveries.
    Steps to reproduce scenario:
    1.Create a Sales order with several items and use text lines, regular and subtotals.
    2.Create more than one delivery based on the sales order and deliver in a different sequence than appears on the sales order.
    3.Open an AR Invoice and u2018Copy fromu2019 > Deliveries. Choose multiple deliveries. Choose u2018Customizeu2019.
    4.Look at the sequence of items on the Invoice. How can the items and subtotals and headings be moved around so they appear in the same sequence as on the sales order?
    Current Behaviour:
    In SAP B1 itu2019s not possible to delete or add more than one row at a time on the AR Invoice or Draw Document Wizard.
    Itu2019s not possible to copy/paste a row on the AR Invoice or Draw Document Wizard.
    Itu2019s not possible to change the sequence of the rows using the Draw Document Wizard.
    Business Impact: This customer is currently spending a lot of time trying to organize the AR invoice into a presentable format. They have to go through the invoice and delete the inapplicable rows one by one (because SAP B1 does not have the ability to delete multiple lines at a time) and also has to manually delete re-add rows to make it follow the same sequence as the sales order.
    Proposals:
    Enable users to delete or add more than one row at a time on the AR Invoice or Draw Document Wizard.
    Enable users to copy/paste rows on the AR Invoice or Draw Document Wizard.

    Hi Rahul,
    You said 'It is not at all concerned with Exchange rate during GRPO...' If that is the case how does the Use Row Exchange Rate from Base Document in the draw document wizard work? Does this mean 1 GRPO : 1 AP Invoice so I can use the base document rate?
    How should I go about with transactions like these? That is adding an AP Invoice from multiple GRPO's having different exchange rates. What I am trying to capture here is that in the AP Invoice, base document rates should be used in the row item level and not the current rate when adding the invoice.  
    Thanks,
    Michelle

  • How do I create an "Add Row" button (add instance with click activity)

    I've been looking through a couple of examples, but the xml is lost on me. I need to learn how to do this for myself because it'd help me out on so many forms. There're forms I just simply cannot do without this function.
    Where I get lost is the javascript linking the button to the specific table. I've been trying to use this I found in an example:
    <event activity="click"><
    script contentType="application/x-javascript">SAPS350a.Page1.TableData1.Table1.Row2.instanceManager.addInstance(1);</script></
    event>
    Now, I'm a complete newbie, so I'm sure someone can point out to me exactly what's wrong, but I dont know what "SAPS350a" means nor can I figure out where the label "TableData1" connects to.
    If anyone can explain this in a "add rows for dummies" fashion, I'd be greatly appreciative.
    See attached an example of one of the fields I need to repeat.

    Hi Liz. You shouldn't really be playing in the xml. Especially if you are a newbie . You could corrupt the whole form if you do something wrong and you probably wont be able to rectify it. Scripts must be added in the script window. In your post, the 'SAPS350a.Page1...' is the path to the row of the particular form that you copied that code from. I have added a button to your form. have a look at the script to see what i have done.

  • Cannot add row without complete selection of batch/serial numbers while creating Goods receipt purchase order

    Error:Cannot add row without complete selection of batch/serial numbers
           Dim oPDN As SAPbobsCOM.Documents
           oPDN = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseDeliveryNotes)
                         Dim serno As String = "SH-A1,SH-A2"
                        Dim sernoval As String() = serno.Split(",")
                        Dim mnfser As String = "SH-B1,SH-B2"
                        Dim mnfserval As String() = mnfser.Split(",")
                        For k = 0 To sernoval.Length - 1
                            oPDN.Lines.SerialNumbers.InternalSerialNumber = sernoval(k).Trim
                            oPDN.Lines.SerialNumbers.ManufacturerSerialNumber = mnfserval(k).Trim
                            oPDN.Lines.SerialNumbers.Quantity = linedetails(iRowNo).Quantity
                            oPDN.Lines.SerialNumbers.SetCurrentLine(k)
                            oPDN.Lines.SerialNumbers.Add()
                        Next
                    oPDN.CardCode = "C232323"
                    oPDN.Lines.ItemCode = "A00004"
                    'oGR.Lines.LineNum = 0
                    oPDN.Lines.BaseLine = 1
                    oPDN.Lines.BaseEntry = 202
                    'oGR.Lines.BaseRef = 203
                    oPDN.Lines.BaseType = 20
                    oPDN.Lines.Quantity = 1
                    oPDN.Lines.UnitPrice = 2
                    oPDN.Lines.WarehouseCode = '01'
                 oPDN.Lines.Add()
                 lRetCode = oPDN.Add

    Hi Vasanth,
    Invert the SetCurrentLine () and Add() at the end of the SSSerialNUmbers loop.
    Regards,
    Eric

  • How to use add row button of a tabuler form.

    Hi all,
    I have created a Tabuler form in my application.Could you please tell me 'How can i use the add row button of this form' as When i click the button "NOTHING HAPPENS".
    Thanks
    Regards,
    Neha

    Hi,
    If you edit the button, the button name has to be 'ADD'. You can make the text / label whatever you like. On the form edit page, the button should appear with this text next to it: submit as "ADD".
    HTH

  • Weird Problem with Add Row Button in Master Detail Page

    I have a page that was created with a Master Detail Wizard. When I click the Add Row button on our Production Environment, the row counter increments BUT no blank row shows on the screen.
    In our Development Environment, when I click the Add Row button, a blank row appears as expected. Thinking there was some problem with the production app, I exported the Dev version and imported into Production. Still no blank row.
    Thinking perhaps it had something to do with the data, I copied our production application data back into the development application tables. Still, the development app creates the blank row where the production version does not.
    I even used the same browser window for both environments and still get the same results. This was working fine in production then just stopped one day.
    The only clue I have is that the Add Row WILL work if the Master Record has no details or less than a page worth. It seems to happen when the detail records are more than one page worth. Also, when I click the Add Row button, it goes to the last page of the list (say three pages of 10, 10, 6) but no blank row shows up. Again, works fine in the development environment no matter how many pages.
    Any ideas or suggestions why this is happening? Could there be some environment setting that is causing this to happen?

    I have a page that was created with a Master Detail Wizard. When I click the Add Row button on our Production Environment, the row counter increments BUT no blank row shows on the screen.
    In our Development Environment, when I click the Add Row button, a blank row appears as expected. Thinking there was some problem with the production app, I exported the Dev version and imported into Production. Still no blank row.
    Thinking perhaps it had something to do with the data, I copied our production application data back into the development application tables. Still, the development app creates the blank row where the production version does not.
    I even used the same browser window for both environments and still get the same results. This was working fine in production then just stopped one day.
    The only clue I have is that the Add Row WILL work if the Master Record has no details or less than a page worth. It seems to happen when the detail records are more than one page worth. Also, when I click the Add Row button, it goes to the last page of the list (say three pages of 10, 10, 6) but no blank row shows up. Again, works fine in the development environment no matter how many pages.
    Any ideas or suggestions why this is happening? Could there be some environment setting that is causing this to happen?

Maybe you are looking for