Looping through multiple levels of Record Lists

I run into this issue all of the time and I never remember how I solved it last.

I have the following record structure:

Rec
RecList1
RecList2
RecList3

I want to loop over RecList3 and specify index 0 for RecList1 and RecList2. So I specify the following in my LOOP in-array:

/Rec/RecList1[0]/RecList2[0]/RecList3

In the MAP step inside the LOOP, I expect to see RecList1, 2, and 3 shown as single Records, but only RecList1 is shown a single Record and RecList2 and RecList3 are shown as RecordLists.

What am I doing wrong?

Put /Rec/RecList1[0]/RecList2[0] as the loop scope

and then only RecList3 as the inArray

Hi I am facing the same problem.i want to get ouput struture as outRec/outRec[o]/outRec[1]/outRec[2].
Can you please post the code for this requirements.

Above statement looks like, you have only one list. What is your requirement?

-Senthil

Hi Senthil,I want output like below.

I got the above output using Values in but i want the same output with IData Pipeline.Please help me as i am new to web methods.

Hi Senthil,I want output like below.
inputRec
documentid
outRec
outRec[0]
DocumentID
outRec[1]
DocumentID
outRec[3]
DocumentID
I got the above output using Values in but i want the same output with IData Pipeline.Please help me as i am new to web methods.
Below is my code using Values in
Connection c = null;
Statement s = null;
Values audit = new Values(5);

try {
String WhereCondition = in.getTrimmedString(“WhereCondition”);
String Table = in.getTrimmedString(“Table”);

// DB connection parameters
Values DBRec    = in.getValues("DBrec");
String dbUrl    = "";
String user     = "";
String password = "";
String DBClass  = "";
if ((DBRec == null) || (DBRec.isEmpty()) || (isEmpty(DBRec.getString("DBUrl")))) {
    dbUrl    = getParameter("dbURLSOM" , "SpGeneralUtil");
    user     = getParameter("dbUserSOM", "SpGeneralUtil");
    password = getParameter("dbPassSOM", "SpGeneralUtil");
    DBClass  = getParameter("dbDriver" , "SpGeneralUtil");
}
else {
    dbUrl    = DBRec.getString("DbUrl");
    user     = DBRec.getString("User");
    password = DBRec.getString("Pwd");
    DBClass  = DBRec.getString("DBClass");
}

// establish DB connection
Class.forName( DBClass );
c = DriverManager.getConnection(dbUrl, user, password);
s = c.createStatement();
c.setAutoCommit(false);

String [] columnList = in.getStringArray("tblPODetailColumnList");

// get tblPODetail columns if provided

String selectList = "";
if (columnList != null) {
    for (int i=0; i < columnList.length; i++) {
        if (!isEmpty(columnList[i])) selectList += columnList[i];
        if (((i+1) != columnList.length) && (!isEmpty(columnList[i+1])) ) selectList += ", ";
    }
}
else selectList = " * ";
String Query = null;
Query = "SELECT " + selectList + " " +
             "FROM " + Table + "  " +
             "WHERE " + WhereCondition + " ";

s.execute(Query);

SpDBUtil.toOutputValues(s.getResultSet(), out, "outRec", true);
int rowCount = out.getInt("rowCount");
if (rowCount <= 0) throw new Exception("Row Count : Quotation details not found."  );

if (s != null) s.close(); 
if (c != null) c.close();  

exitSuccess("Retrieved Quotation Information successfully.", out);

}
catch (Exception e) {
try {
if (s != null) s.close();
if (c != null) c.close();
}
catch (SQLException f) {
}
return exitError("SpDBUtil.AdminDBUtil:getDocumentList Exception. " + e.getMessage(), out, audit);
}

I am passing inRec as documentid and 2 input strings like one is WhereCondition and another is Table.I am passing the sql select query in code.The query should get executed basing on these inputs and the output should be as i shown in the above