cancel
Showing results for 
Search instead for 
Did you mean: 

SAP ByD - How to access member of collection with specific index

former_member195790
Participant
0 Kudos

Dear Expert

I have developed SAP ByD for a while and wondering that the SDK does not provide any array data type (like in C, JAVA, etc).


Even though  the collection type is pretty much the same as it can contain multiple item. But it has limitation for accessing the item member in the list.



For example.


var result : collectionof DataType::StringDataType;


result.Add(bill_to_id);

result.Add(billto_address1);

result.Add(billto_address2);

result.Add(billto_address3);

result.Add(official_name);

Then I need to access item at index 3.

But the syntax which is available for using is just    .GetFirst(), GetLast()  ....

Can someone please share any idea how to handle this?.

Is it possible to access it   like   result[2] ?  (same as in other programing language)

Best Regards,

Krit R.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

A simple foreach should do the trick.

I don't know if there is a straight forward way


var count = 0;

foreach (var item in result)

{

     count = count +1;

     if (count == 3)

     {

          //access the item here

          item.somevariable...

     }

}