Problems in mapping

Hi,

I have the NEXT struct ADD_PO_003/DATAAREA/ADD_PO/POLINE

ADD_PO_003 is a struct.
DATAAREA is a list of records
ADD_PO is a struct.
POLINE is a list of record

POLINE have a field POLINENUM, this have a consecutive number. by example: 1,2,3,4 … by
POLINE
RECORD_01
POLINENUM = 1
FIELD_X
RECORD_02
POLINENUM = 2
FIELD_X
RECORD_03
POLINENUM = 3
FIELD_X

I tried to mapping, but doesn’t work.

LOOP ADD_PO_003/DATAAREA/ADD_PO/POLINE
MAP $iteration = ADD_PO_003/DATAAREA/ADD_PO/POLINE/POLINENUM

Somebody known what can i do ???
Any idea it’s good.

Thanks so much …
Omar

You need nested loops in this case.

LOOP ADD_PO_003/DATAAREA
map ADD_PO fields
LOOP ADD_PO_003/DATAAREA/ADD_PO/POLINE
map POLINE fields

Don’t mess with $iteration. You can use is it as a map source but don’t use it as a target–you’ll mess up the loop control. Thus, you can do $iteration --> POLINENUM but don’t do POLINENUM --> $iteration.

The key to know if loops are configured properly is that map steps inside the loop should show the list you’re looping over as a record, not a record list. Hope this helps. If not, post more of your mapping code for review.

Hi Rob,

I’m sorry, i am new in this.

The general struct is

ADD_PO_003/DATAAREA/ADD_PO/POLINE

  1. ADD_PO_003 (RECORD)
    1.2 DATAAREA (RECORD LIST)
    1.2.1 ADD_PO (RECORD)
    1.2.1.1 POLINE (RECORD LIST)
    1.2.1.1.1 POLINENUM (FIELD)

By each record of POLINE, POLINENUM (field) have a consecutive number, begining in 1.

How do you do this ???

I don’t undestand very well your recomentation.

Omar

I have the next >:

  1. [MAP] zContador = 1
  2. [LOOP] /reg_OEX/ADD_PO_003/DATAAREA[0]/ADD_PO/POLINE
    2.1 [MAP] zContador = reg_OEX/ADD_PO_003/DATAAREA/ADD_PO/POLINE/POLINENUM
    2.2 [MAP TRANSFORMER= addInts] zContador++

At finish, i have *DATAAREA = null

  1. [LOOP] /reg_OEX/ADD_PO_003/DATAAREA
    1.1 do anything you need with ADD_PO
    1.2 [LOOP /rereg_OEX/ADD_PO_003/DATAAREA/ADD_PO/POLINE
    1.2.1 [MAP] /rereg_OEX/ADD_PO_003/DATAAREA/ADD_PO/POLINE = $iteration

You don’t have to keep a counter yourself. You can use $iterator. From your first post, it looked like you were trying to assign something to $iterator. Don’t do that, but you can assign $iterator to a field in your structure just fine.

Hi,

Your idea works.
Thanks so much.
Omar