Loop and Map Problem

I read an XML file and map the data into a record structure. I do see the data when I map the data to a record structure. I need to map the data into parameters and a record list to make a remote function call to SAP. My looping and mapping looks like this.

Loop on /level_1/level_2/level_3 (No out array specified)
–Map to a temporary record reference (same structure as set of fields under level 3)
–appendToRecordList (tmp rec ref from above TO from_item)
…………(tolist TO record reference list that is the final list)

I do not see any data in the final list. Also, when I debug I see that the flow goes through the loop, map and appendToRecordList steps. But, I do not see the data in any of the steps.

I went through the postings and archives to find the solution. I did see the postings on to use the appendToRecordList. I tried the different options, but without any luck.

I appreciate your help.

Frustrated,
Roger

Roger,

Are you still having problems with using appendToRecordlist?

The trick is when you map the temp rec ref to fromItem,just drop the temp rec in the PipelineIn and also you should map the toList PipelineIn aswell PipelineOut,drop the fromItem too.This makes data appending correctly and not get overwritten…

Please step thru the flow in the loop when the append occurs and let us know the behaviour.

Also lot of threads discussed on this append service in detail (pros and cons)etc…

HTH,
RMG

Please make sure that TempRec is mapped to tolist and current loop record to fromitem.

RMG and Sreenivas,
Thanks for your reply.

I cannot see the data in my temp record reference right after my loop step. Here is the situation.

Loop on ‘Level1/Level2/Level3’
Loop on /level_1/level_2/level_3 (No out array specified)
–Map to a temp record reference (same structure as set of fields under level 3)
I do not see any data in the temp record. I am using appendToRecordList after the map step. But, I do not see any data even before I hit the appendToRecordList service.

I have created a record structure that is similar to a structure under level 3.

In the map step, I have created the temp record as a record reference to the record structure as above.

RMG, I had the appendToRecordList problem in another service, where I was able to by pass using that service. But, in this case I have no chocie but to use it :frowning: .

I appreciate your help.

Regards,
Roger

Roger,

Please make sure in the loop step wheter the data mapping to the temp record occurs and temp rec is successfully appending to orignal list.

HTH,
RMg

RMG,
Here is the steps in my flow service.

login
ls
Loop over ‘/dirlist’
–get
–bytesToString
–StringToDocument
–documentToRecord(XML document to record structure)
–Loop over data from above and map it to fields and structure
–before calling the RFC
–call RFC
–delete the file
logout

I see the data upto and after the documentToRecord step. When I loop through this structure and map it to a temp rec structure, I do not see any data in my target structure.

My XML structure looks like this.

ABC
–(+)ABCHeader
–(-)SHIP
----HEADER
------FIELD 1
------FIELD 2
------etc.
------(-)DETAIL (record list) contains line item data
--------field 1
--------field 2
--------etc.,

I have created a ship_detail record structure that has all the fields of DETAIL.

I am looping as below
Loop over '/ship/ABC/
–Loop over ‘/ship/ABC/SHIP’
----Loop over ‘/ship/ABC/SHIP/HEADER’
------Map individual fields from DETAIL to corresponding fields tmp_rec
------tmp_rec is created as a record reference to ship_detail

When I debug, I see that the flow goes through each loop and the map step. But, I do not see tmp_rec in the Results at all. I have played around with indexing. System defaults ‘0’ as the value. I have blanked it out.

Please help me out here. I am running out of options.

Thanks,
Roger

Roger,

When you are mapping inside the loop structure please make sure the record list should show as record and see if there is any indexing problem in the mapping which makes null in the temp record,so this could be the reason of not showing the data in the temp record.

Are you using outArray of loop?If so just use inArray and make sure the above comments.

Please confirm.

HTH,
RMG

Roger,
Just one detail make sure you are looping over the detail. In your post the lowest level of looping was over ship header.

Another small tip is to delete your mapping connections and hit save then do the same for your appendToRecordList as well as any other steps within that detail loop. After that look at the pipeline and see what is in it. Make sure your temporary record (non-list record) has a unique name like singleDetail or something so it is easily identified for the appendToRecordList. verify that your pipeline is clean, save the service then remap the steps. I have had weird things like this happen when I have played with the service a little too much and found that a cleanup process, save and remap helps sometimes.
Good luck!
Dawn

RMG and Dawn,
Thanks for your replies.

I changed my loop to loop at the lowest level possible so that I was at a record level. My sample data had only one record at the detail level, hence when I debugged my flow step would not step inside the loop. I didn’t know that the loop would fail if there is only one record in the record list.

Now my service will loop and map it to the temp record. I check if there are records, if not, I map the single record from detail list to the temp record. This seem to work now. I am also using appendToRecordList successfully now. It was pretty frustrating in the beginning and now I am back on track (may be until I hit another block) !!

Thank you both for your valuable suggestions.

Regards,
Roger

Roger,

Glad to hear about that you have resolved the problem.In any new developments when we hit some blocks only we can learn in detail with some R&D and debugging helps a lot.

PS:Loops,appending steps are always dangerous and tricky though as always.

Goodluck,

Hi All,
I ve created a JDBCAdapter Service that inserts data into a table which contains a field with the datatype as NUMBER(say phoneNo).But the adapter service has created an OBJECT IS datatype for the corresponding NUMBER datatype in the table as its input.The problem is while mapping any value to the object datatype field as the input for that Adapter Service in the flow,there is an error at the runtime.The data is not getting mapped to that object.

Is there any other way to insert values to that number field in the table.

Expecting your valuable Suggestions.

Thanks,
Suren.

Suren,

In the Adapter Service you have to select the JDBC Input Field Type as java.lang.string,this makes you map string to insert service input and works as expected.

HTH,
RMG

Hi RMG,
Thank you very much for you suggestion.I followed your way,now the adapter service changed its input variable as STRING datatype.Now Im able to insert values to that variable…

Thanks,
Suren.M