A version of recreplace which does not require a lock key.
Namespace: NetricsServerInterface
Assembly: NetricsServerInterface (in NetricsServerInterface.dll)
Syntax
| Visual Basic (Declaration) |
|---|
| Public Function recreplace( _ ByVal tblName As String, _ ByVal src As NetricsTableRecSrc, _ ByVal doMaxWork As Boolean _ ) As NetricsTableStats _ Implements INetricsServerInterface.recreplace |
| C# |
|---|
| public NetricsTableStats recreplace( string tblName, NetricsTableRecSrc src, bool doMaxWork ) |
| C++ |
|---|
| public: NetricsTableStats recreplace( String tblName, NetricsTableRecSrc src, bool doMaxWork ) sealed |
| J# |
|---|
| public NetricsTableStats recreplace( string tblName, NetricsTableRecSrc src, bool doMaxWork ) |
| JScript |
|---|
| public
function recreplace( tblName : String, src : NetricsTableRecSrc, doMaxWork : bool ) : NetricsTableStats |
Implements
INetricsServerInterface.recreplace
Example
This sample shows how to replace records in a table from a csv input file.
Copy Code
| |
|---|---|
using NetricsServerInterface;
class MyClass
{
private static NetricsServerInterface.NetricsServerInterface si = null;
public static void Main()
{
try
{
String host = "localhost";
int port = 5051;
si = new NetricsServerInterface.NetricsServerInterface(host, port);
// CSV input file of records to be replaced
String file = "c:\\temp\\names.csv";
// Target TIBCO Patterns Engine table
String table = "names";
NetricsTableStats response = null;
// Set doMaxWork to true if you want to ignore format errors on input file and continue
bool doMaxWork = false;
// Load .csv file.
// CSV is without a key in file.
NetricsRecFile netricsRecFile = new NetricsRecFile(file);
// Set the initalKey for the records being replaced. Key is incremented by 1 for each record in file.
netricsRecFile.setInitialKey(1);
// First record in csv file is a data record and not a header so setFieldNamesFirst
// should be set to false
netricsRecFile.setFieldNamesFirst(false);
// set the record source for the recadd method
NetricsCSVRecSrc src = new NetricsCSVRecSrc(netricsRecFile);
response = si.recreplace(table, src, doMaxWork);
Console.WriteLine("Records replace: Number of records in table " + table + " is " + response.getNumRecs() + ".");
}
catch (NetricsException e)
{
Console.Write(e.getErrorDescription() + "\n");
}
}
}
| |