Skip to Content
0
Former Member
Jan 05, 2008 at 05:22 AM

How to get Multiple records from functions

18 Views

Hi Everyone

Im new to this stuff. Im trying through JCO. As far as the single recordsets like data of customer or article are concerned i get it through an array.

But i wanted to retrieve

1- Whole tables like (all articles)

2- Selected articles. or Customer order details (articles in PO)

That means multiple records in one go.

Later on ill display it in JTables.

Like for the past three days i was googling around. Thought like this ones not for my stomach. Came across this Forum. Thought its worth posting a request.

Here is the code

-


public String[] KSearch(String Knr) throws Exception{

String[] Result=new String[11];

IFunctionTemplate ftemplate= Con.repository.getFunctionTemplate("SucheKUNDE");

if (ftemplate == null)

throw new Exception("Funktionstemplate nicht gefunden");

JCO.Function function = ftemplate.getFunction();

JCO.ParameterList input = function.getImportParameterList();

input.setValue(Knr,"FieldName");

JCO.Client client = JCO.getClient(Con.conPoolId);

client.execute(function);

JCO.ParameterList output = function.getExportParameterList();

Result[0]=output.getString("NAME");

Result[1]=output.getString("VORNAME");

Result[2]=output.getString("GDATE");

Result[3]=output.getString("TELEFON");

Result[4]=output.getString("MAIL");

Result[5]=output.getString("STRASSE");

Result[6]=output.getString("PLZ");

Result[7]=output.getString("ORT");

Result[8]=output.getString("KONTO");

Result[9]=output.getString("INSTITUT");

Result[10]=output.getString("BLZ");

JCO.releaseClient(client);

return Result;

}

-


now instead of a single record what if im expecting a number of records, like what if i need customer over 25. Which means more than one. I have to get in tabular format so that i can display it in JTables.

Hope it a bit illustrative.

Regards

Edited by: Aaron Maleck on Jan 5, 2008 7:35 AM