Converting Record Lists to List


I am trying to write an extension that performs calculations on a list of information obtained by an external system.

My theory was to write it using LINQ in Integration Studio.

I wrote some Sample Functions which work in a normal C# application

    public decimal returnPremium(List<MyList> MyList)


            var Premium = ssMyList.Where(item => item.Status == "Old").Sum(item => item.Premium);

            return Premium;


However, I am passing a Record List into the Extension and looping round that to populate List<MyList>, trouble is, everytime I do this I seem to get results of 0, despite being decimals in my list.

This is how I populate this list I created

        public List<MyList> createList(RLOutsystemsRecordList myRecordList)


            List<MyList> MyList = new List<MyList>();

            MyList myRecord= new MyList();


                myRecordList.StartIteration(); //Start iteration from the start

            while (!myRecordList.Eof)//indicates in the end of the list


                //Access Current rec for the current information

                myRecord.Premium = myRecordList.CurrentRec.ssSTMyRecord.Premium;






            return MyList;


Should I be passing an Object into the Extension? Or have I missed something obvious?

Hi Edward,

At a first glance, that looks ok. You could pass an Object, but then you'd have to use reflection to get something out of it, so I'm not sure that would be the way to go.

Hi Killian,

Thanks for your reply. After spending a lot of the day debugging I've discovered that it only seems to be adding the last record, which in all my examples was 0. Hence the result of 0

I thought the Reset() would start the iteration again?


I don't think the Reset() is needed. See this very old post that is still valid, afaik. So I'm not sure why only the last record is added. I would advice you to add some debugging output to the logging, to see if it's really not being iterated, or the problem lies with the List<MyList> and the Add().

GenericExtendedActions.LogMessage(AppInfo.GetAppInfo().OsContext, "My message", "XXXX");

Hi Kilian. I'm able to get some results in Service Centre from the Logging. I will do more investigation and see if I can find the root cause.



Thanks for the update, keep us posted!


Hi Killian.

The debug told me it was iterating successfully, so I knew the problem was with the Add.

After looking around, I found a solution. Effectively I needed to create a new record within the loop to ensure this was always being added.

public List<DecimalHolder> createDecimalList(RLDecimalRecordList ssDecimalList)


            List<DecimalHolder> decimalList = new List<DecimalHolder>();

            RLDecimalRecordList newList = ssDecimalList;





                DecimalHolder decimalRecord = new DecimalHolder();

                decimalRecord.DecimalValue= newList.CurrentRec.ssSTDecimal.ssDecimal;





           return decimalList; 


Interestingly after reviewing with my colleagues, I did not need to create my own list as I could perform a LINQ query on said List by referencing System.Collections and System.Reflection

 public decimal AddUpList(List<DecimalHolder> decimalHolderList)


            decimal ssSum = 0.0M;


            ssSum = (from d in decimalHolderList

            select (decimal?)d.DecimalValue).Sum() ?? 0;

            return ssSum;


Many thanks for all your help :)


Hi Edward,

Thanks for the feedback! I wouldn't have thought creating a new record would be necessary, but I did a quick Googling and apparently only a reference to the object is added to the list, so the behaviour makes sense. My OutSystems skills are way better than my .NET skills :).