Search code examples
genexus

Genexus: Use of Collection Variable in For Each


I'm getting an error when I'm using a variable collection inside a For Each command:

For each
   where itemId in &items
   ...
   ...
   ...
EndFor

Where &items is a collection variable of Attribute itemId

How can I make it work?

Thanks in advance.


Solution

  • Pablo, What error are you having?

    I suspect that ItemId (based on its name) is not at itesm.item type and should be that type. &Items collection of item &Item is defined as &items.item

    for &Item in &items()
        &Item.Id
    endfor
    

    please check this link for further information: https://wiki.genexus.com/commwiki/servlet/wiki?8585,For%20In%20Array%2FCollection%20Command

    Gustavo