Dictionary with some nested dictionary

Hi guys,
i’ve a problem creating a dictonary who has some single values except one who is made by an array. Maybe the code can help you understand what i mean :

Using Xojo.Core
Using Xojo.Data
Dim d As New Xojo.Core.Dictionary
Dim arrayInvoiceItems() As  Auto
Dim InvoiceItem As New Xojo.Core.Dictionary
Dim json As Text
Dim data As MemoryBlock
d.Value("api_uid") = "XXX"
d.Value("api_key") = "XXXX"
d.Value("id_cliente") = "1111"
d.Value("autocompila_anagrafica") = "true"
d.Value("valuta") = "EUR"
d.Value("prezzi_ivati") = "false"
d.Value("nascondi_scadenza") = "true"
d.Value("mostra_info_pagamento") = "false"

if Prezzo.Text = "" then
  InvoiceItem.Value("quantita") = 1
  InvoiceItem.Value("descrizione") = Val(Descrizione.Text)
  InvoiceItem.Value("prezzo_netto") = Prezzo.Text
  InvoiceItem.Value("categoria") = Tipologia.Text
  ArrayInvoiceItems.Append InvoiceItem
end if
if Prezzo1.Text = "" then
  InvoiceItem.Value("quantita") = 1
  InvoiceItem.Value("descrizione") = Val(Descrizione1.Text)
  InvoiceItem.Value("prezzo_netto") = Prezzo1.Text
  InvoiceItem.Value("categoria") = Tipologia1.Text
  ArrayInvoiceItems.Append InvoiceItem
end if
d.Value("lista_articoli)" = ArrayInvoiceItems
json = GenerateJSON(d)
data = TextEncoding.UTF8.ConvertTextToData(json)
ClasseHTTP.SetRequestContent (data,"application/json")
ClasseHTTP.Send ("POST","https://xxxxxxx")

I got a Type Mismatch error when i try to assign arrayInvoiceItems to d.Value(“lista_articoli”).

What I’m doing wrong ?


perhaps this is a place where a couple of database tables would solve the problem more effectively?

This line:

d.Value("lista_articoli)" = ArrayInvoiceItems

You put the closing paren within the quote, so there is no closing paren. My guess is that you looked at the wrong error as “Type Mismatch” is reported alongside the actual error.