Showing results for 
Search instead for 
Did you mean: 

how do i send a datasource getvalue into an array

Former Member
0 Kudos

Help - I am trying to get values from a datasource into my array (which I will then use for sorting before populating a matrix). I get the following error:

Form - Reserved/Illegal form Unique ID [66000-2]

code getting the error:

Dim lbpname As String

lbpname = oDBDataSource.GetValue("CardName", oDBDataSource.Offset)

What other methods can I use to get the values from my datasource? Or how can I make the above work?


Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos


I think that your way isnt so correct, because youll need to fill matrix cell by cell and this is too slowly. Creating of aray isnt necessary, use datatables instead of datasource and the sort the resulkt directly in sql query and then bind the datatable to matrix.

The example is as:

create datatble

Dim odbtable As SAPbouiCOM.DataTable

Dim sql As String

odbtable = oFormKontrolaZak.DataSources.DataTables.Add("VEP")

sql = "SELECT * from [dbo].[@table] where x=1 order by x"



then bind it to dataatble as

Dim cols As SAPbouiCOM.Columns

Dim column As SAPbouiCOM.Column

cols = oMatrix.Columns

column = cols.Item("colCisZak")

column.DataBind.Bind("VEP", "u_ciszak")

and then load it from datasource as:


this is quickest way how to achieve it.

hope it helps


Former Member
0 Kudos

The ideal way to do this would be as you suggest. Unfortunately I inherited this project and the exisiting code is too extensive to just make such a change - it would require a major rewrite - so I am trying to do a sort with as little other coding as possible. The data is coming from a datasource query on oConditions.

Although I expect the results to be slow, I am trying to take the output of the datasource query and sort it with an array, then I am adding to the matrix. An SQL statement isn't an option here, but it would be better.

Former Member
0 Kudos

ok, I replied your thread about sorting, check if my idea is useable for you.

Former Member
0 Kudos

I am using a 2 dimensional array and quicksorting it. Then I assign the datasource offset to the array values, and this is where I have trouble now. How does the offset know what field to sort based on the offset. I think I am missing something important here, how I identify to the offset which field the array represents. My code gets no errors, I just end up with the same unsorted data as I do without any of my code.

The code is like this, to sort on cardcode:


***Loop through and populate the 2 dimensional array

Dim sArray(2, oDBDataSource.Size - 1) As String

Dim i As Integer

Dim lbpname As String

For i = 0 To oDBDataSource.Size - 1

oDBDataSource.Offset = i

lbpname = oForm.DataSources.DBDataSources.Item("OINV").GetValue("cardcode", 0)

sArray(1, i) = i

sArray(2, i) = lbpname


QuickSort(sArray, LBound(sArray), UBound(sArray), 2) ***this quicksort routine is working as far as I can tell.

***Offest datasource and add rows to the matrix

Dim counter1 As Integer

For counter1 = 0 To (oDBDataSource.Size - 1)

oDBDataSource.Offset = sArray(2, counter1)



Any ideas? My thought is that the offest doesn't know what field to use.


Answers (1)

Answers (1)

Former Member
0 Kudos

I doubt the problem is:

lbpname = oDBDataSource.GetValue("CardName", oDBDataSource.Size)

Edited by: Hongjun Min on Mar 17, 2008 4:37 AM

Former Member
0 Kudos


Try this code,

aForm.DataSources.DBDataSources.Item("@TABLE NAME").GetValue("CardCode", 0)