4D Write Pro – Insertion and deletion of rows and columns

Automatically translated from English

You already know that 4D Write Pro allows you to create tables and append rows to them. With 4D v18, we’ve got more thrilling news! We’re excited to announce that managing the insertion and deletion of rows and columns is not only possible, it’s also very easy. This can be done either by programming, thanks to four new commands, or by using the interface (via the widgets or the contextual menu). Keep reading for more details!

 

4DWP: insertion and deletion of rows and columns

Four new commands to manage rows and columns

In order to insert rows and columns, two new commands have been created:  WP Table inserts rows and WP Table insert columns. Both commands return ranges that correspond to parts created inside the table. Following the same logic, two complementary commands have been created to remove rows and columns: WP TABLE DELETE ROWS and WP TABLE DELETE COLUMNS. I’m sure you’ve figured out what they do!

//To insert 2 rows starting at line 3
$row:=WP Table insert rows(WPtable;3;2)
//To delete the second column:
WP TABLE DELETE COLUMNS(WPtable;2;1)

Updated commands

The WP Table get rowsWP Table get columns and WP Table get cells commands have been improved too!

They can still be used to create ranges inside a table as before:

$row:=WP Table get rows($table;3;2)

Now, they can also be used to get information about ranges belonging (or not) to a table. All of these commands can now receive a range as a parameter and will return an object containing useful information such as:

For example, let’s say you want to display information about selected cells, here’s the way to go:

$userSelection:=WP Selection range(WParea)
$cells:=WP Table get cells($userSelection)
If ($cells#Null)
 Form.info:=New object
 Form.info.firstRow:=$cells.firstRow
 Form.info.firstColumn:=$cells.firstColumn
 Form.info.rowCount:=$cells.rowCount
 Form.info.columnCount:=$cells.columnCount
End if

Automatic actions

Automatic actions are also available to insert or delete rows and columns according to current selections in a table:

Roland Lannuzel

• Product Owner & 4D Expert •

After studying electronics, Roland went into industrial IT as a developer and consultant, building solutions for customers with a variety of databases and technologies. In the late 80’s he fell in love with 4D and has used it in writing business applications that include accounting, billing and email systems.

Eventually joining the company in 1997, Roland’s valuable contributions include designing specifications, testing tools, demos as well as training and speaking to the 4D community at many conferences. He continues to actively shape the future of 4D by defining new features and database development tools.