How to read view by code (client side)


Dataweb project is based on a RDBMS (HSQLDB or Postgres) but usually you don't use SQL, but the specific classes. The following code shows how to open data of a view on the client side which is not the best choice, but the best way is use server-side code:

// Get an active view object
dataweb.client.View view=client.openView(session, "<Package>.<View>");

// Apply filter and order
view.applyFilter("<Condition>", "<Order>")

// We want read data
for (int i=0;i<=view.getRowCount()-1;i++){
   val1 = view.getValue(i, "<Column Name>");
   valn = view.getValue(i, "<Column Name>");

// Close view object

Published in Fri, 10 December 2010 16:16