delete inserted row

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

HarryDeBoer
Ebase User
Posts: 118
Joined: Tue Oct 23, 2012 7:01 am
Location: The Netherlands

delete inserted row

#1

Postby HarryDeBoer » Wed Jul 31, 2013 7:46 am

Hi

In an importroutine I import records in a table and at the end I do an updateTable(). I loop through a file and insert a record in the table for each filerow. If a record is not valid I want to delete it (so that it is not imported). Because the record is inserted it has now rownumber so how do I use xxx.deleteRow(?) ? Or is there another way?

Regards, Harry
0 x
Kind regards,

Harry

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#2

Postby Jon » Wed Jul 31, 2013 8:02 am

Harry,

All rows have a row number - it's assigned by the system when the row is inserted.

There are two ways to delete a row, with and without a row number i.e.

Code: Select all

tab.deleteRow();
tab.deleteRow(25);
The first one deletes the table's "current row". A row is the current row when you insert it or when you loop through the rows e.g. you can do this:

Code: Select all

tab.insertRow();
tab.deleteRow();      // deletes the row just inserted
or you can do this:

Code: Select all

var rows = tab.rows;
while (rows.next())
{
  if ...
   tab.deleteRow();
}
To delete using a row number, you would normally find the row first e.g.

Code: Select all

var row = tab.findRow(tab.COL1, "value");
if (row != -1)
  tab.deleteRow(row);
Regards
Jon
0 x


Who is online

Users browsing this forum: No registered users and 21 guests