on 10-29-2008 8:40 AM
public String[] getExportSParams(JCO.Function function, String structure,
String[]tablefield) {
JCO.ParameterList export = function.getExportParameterList();
JCO.Structure structures = export.getStructure(structure);
String[] exportField = null;
for (int i =0; i<tablefield.length;i++){
exportField<i> = structures.getString(tablefield<i>);
}
return exportField;
thank you very much, it helps me a lot.
regard
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Hope the following resolves your issue
public String[] getExportSParams(JCO.Function function, String structure,
String[]tablefield) {
JCO.ParameterList export = function.getExportParameterList();
JCO.Structure structures = export.getStructure(structure);
//Creating objects here i assume that your tablefield and export field will be of same size
String[] exportField = new String[ tablefield.length ]
for (int i =0; i<tablefield.length;i++){
exportField<i> = structures.getString(tablefield);
}
return exportField;
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
sorry, that was a mistake, I sent my code without my question.I was too fast. My question is: I get a "java.lang.NullPointerException" on the "exportField" of the above code. I don´t know why. Could you help me please?
regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Bit confusing.
Assuming that what ever you had given in your question is exactly the "copy paste" from your code...
?Both "tableField" and "exportField" are arrays right. Why are you using those variables directly in places where you are supposed to use a "String".
?You are trying to put some string into exportField (which is an array) which is not yet initialized.
Can you try this out -
/* I guess, you are trying to extract the content of the structure into an array of strings and send it back */
public String[] getExportSParams(JCO.Function function, String structure,
String[]tablefield) {
JCO.ParameterList export = function.getExportParameterList();
JCO.Structure structures = export.getStructure(structure);
String[] exportField = null;
if(tablefield!=null && tablefield.length>0)
{
exportField=new String[tablefield.length];
for (int i =0; i<tablefield.length;i++){
exportField<i> = structures.getString(tablefield<i>);
}
}
return exportField;
Hi,
thank you for answer, but I dont understand it. I have tried with the following code. But I have the same errormessage. I need a String[] as return code. How can I solve this?
if(tablefield!=null && tablefield.length>0)
{
for (int i =0; i<tablefield.length;i++){
String tab = tablefield<i>;
exportField<i> = structures.getString(tab);
}
}
return exportField;
for (int i =0; i<tablefield.length;i++)
{
String tab = tablefield<i>;
if(tab!=null && tab.length>0)
{
try
{
exportField<i> = structures.getString(tab);
}
catch(Exception e)
{
//print error.
}
}
else
{
exportField<i> = //some condition what you want
}
}
return exportField;
I think this code might help you a lot
jayesh talreja
User | Count |
---|---|
86 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.