Analytics-Plus Help

AddRow.java

The following is the sample code for adding a row to a table in a database in ManageEngine Engine Analytics Plus. In this example a row is added to the table "Sales".

Before trying it out

public class AddRow
{

publicstatic 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();

}

privatestatic HashMap getRowValues()
{
SimpleDateFormat dtFmt = newSimpleDateFormat("yyyy/MM/dd HH:mm:ss");
HashMap rowValsMap = newHashMap();
rowValsMap.put("Date",dtFmt.format(newDate()));
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;
}

publicstatic void main(String[] args)
throws Exception
{
addRow();
}
}

Share this post : FacebookTwitter