AddRow.java
The following is the sample code for adding a row to a table in a database in Zoho Reports. In this example a row is added to the table "Sales".
Before trying it out
public class AddRow
{
public static void addRow()
throws Exception
{
ReportClient rc = Config.getReportClient();
rc.login(Config.LOGINNAME,Config.PASSWORD);
String uri = rc.getURI(Config.LOGINNAME,Config.DATABASENAME,"Sales");
Map result = rc.addRow(uri,getRowValues(),null);
System.out.println(" Response " + result);
rc.logout();
}
private static HashMap getRowValues()
{
SimpleDateFormat dtFmt = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
HashMap rowValsMap = new HashMap();
rowValsMap.put("Date",dtFmt.format(new Date()));
rowValsMap.put("Region","EAST");
rowValsMap.put("Product Category","Sample_Grocery");
rowValsMap.put("Product","Sample_Meat");
rowValsMap.put("Customer Name","John");
rowValsMap.put("Sales","2303");
rowValsMap.put("Cost","1000");
return rowValsMap;
}
public static void main(String[] args)
throws Exception
{
addRow();
}
}