DIM TYPE () ARRAY HELP

lucas555

Member
Licensed User
Longtime User
Hey All,

Sorry if there's already a post that exist, but i've been searching and couldn't find any post referring to Array of Types.

B4X:
Dim Type (ProductCode, PrDescription, OrgQtyBO, OrgQtyShipped, OrgQtyOrdered, Sequence, PrHasComponents, RefPrSequence, PrIsComponent, IsNewOrder) arrProducts(0)

Query = "SELECT COUNT(*) AS PrCount" & CRLF & _
            "FROM [dbo].[OE_Order_Details]" & CRLF & _
            "WHERE [OrderNo] = " & OrderNo
   
Conn.ExecuteQuery(Query)
Conn.Advance
intNbProduct = conn.ReadField("PrCount")
   
arrProducts(intNbProduct)

I'am trying to reset my array to the number of record found in the table for a specefic order. But an Error shows up saying :

arrProducts(intNbProdcut)
Error Description :
Syntax error (missing parameter)

I know that my error is the syntax but I do not know the syntax to correct this error,

Is there anyone who could help me out ?
 

lucas555

Member
Licensed User
Longtime User
Yes, I wish to redim to the new record he fetches, my querty is working but it's giving me an error on the assigned of the array.

Thanks
 

Basic4Life

Member
Licensed User
As far as I know, you can't redim an array with type.
But here's a work around using a corresponding typeless multi dimensional array with matching dimension count.
B4X:
Sub Globals

Dim Type (ProductCode, PrDescription, OrgQtyBO, OrgQtyShipped, OrgQtyOrdered, Sequence, PrHasComponents, RefPrSequence, PrIsComponent, IsNewOrder) arrProducts(0)
Dim  empty(0,10)

End Sub

Sub App_Start

    count = 100
   
    Dim empty(count,10)

    arrProducts() = empty()
   
    arrProducts(88).IsNewOrder = "test"
   
    Msgbox(arrProducts(88).IsNewOrder)


    Form1.Show
End Sub
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…