I have an array like below, which contains an Array called "OrderDetails", which is I think a dictionary not array(I'm not sure what to call it.
in another vc, I have to create OrderDetails and then put it here in dataa.
In the other VC that I have to create OrderDetails, I have a table view, which means the data of the table (some of them) should be set to the array. could somebody help me how should I make that array?
let dataa = [ "Id":0,
"CustomrId": 111,
"PriceVariableId": item[1].priceVariableIdCore,
"PaymentTypeId":item[1].paymentVariableIdCore,
"RefCo":item[1].refcoCore,
"OrderNo":1122,
"ReciverId":0,
"DlvProvinceId":UserDefaults.standard.string(forKey: constantAddress.stateId),
"DlvCityId": UserDefaults.standard.string(forKey: constantAddress.cityId),
"DlvAddress": UserDefaults.standard.string(forKey: constantAddress.addressLine),
"DlvZip": UserDefaults.standard.string(forKey: constantAddress.postalCode),
"DlvTel": UserDefaults.standard.string(forKey: constantAddress.telephone),
"DlvMobile": UserDefaults.standard.string(forKey: constantAddress.mobile),
"TtIsSingle": TAK,
"TtIsDouble": JOFT,
"TtIsTrailer":TREILI,
"Description":EntTozihat.text,
"OrderDetails":["OrderDetailId":0 ,
"Qty":0,
"UnitPrice":600]
]
"OrderDetails":[("OrderDetailId":0 ,"Qty":0,"UnitPrice":600),(),()]
update:
I'm creating the OrderDetails like below:
for _ in 0...item.count {
let dict = ["Id": 0,
"Qty":item[indexPath.row].quantityCore ,
"UnitPrice":item[indexPath.row].feeCore ,
"GoodId":item[indexPath.row].goodIdCore,] as [String : Any]
listArray.append(dict)
}
print("JACK= \(listArray)")
I have to problem here!!! 1) I'm using this right into the "cellForRowAt" with "dequeueReusableCell" which means as many ro as I have it would return the data like below:
JACK= [["Id": 0, "GoodId": 0, "UnitPrice": 0.0, "Qty": 0.0], ["Id": 0, "GoodId": 0, "UnitPrice": 0.0, "Qty": 0.0], ["Id": 0, "GoodId": 0, "UnitPrice": 0.0, "Qty": 0.0], ["Id": 0, "GoodId": 0, "UnitPrice": 0.0, "Qty": 0.0], ["Id": 0, "GoodId": 0, "UnitPrice": 0.0, "Qty": 0.0], ["Id": 0, "GoodId": 0, "UnitPrice": 0.0, "Qty": 0.0], ["Id": 0, "GoodId": 0, "UnitPrice": 0.0, "Qty": 0.0], ["Id": 0, "GoodId": 0, "UnitPrice": 0.0, "Qty": 0.0], ["Id": 0, "GoodId": 0, "UnitPrice": 0.0, "Qty": 0.0], ["Id": 0, "GoodId": 0, "UnitPrice": 0.0, "Qty": 0.0], ["Id": 0, "GoodId": 0, "UnitPrice": 0.0, "Qty": 0.0], ["Id": 0, "GoodId": 0, "UnitPrice": 0.0, "Qty": 0.0], ["Id": 0, "GoodId": 0, "UnitPrice": 0.0, "Qty": 0.0], ["Id": 0, "GoodId": 0, "UnitPrice": 0.0, "Qty": 0.0], ["Id": 0, "GoodId": 0, "UnitPrice": 0.0, "Qty": 0.0], ["Id": 0, "GoodId": 0, "UnitPrice": 0.0, "Qty": 0.0], ["Id": 0, "GoodId": 0, "UnitPrice": 0.0, "Qty": 0.0], ["Id": 0, "GoodId": 0, "UnitPrice": 0.0, "Qty": 0.0], ["Id": 0, "GoodId": 0, "UnitPrice": 0.0, "Qty": 0.0], ["Id": 0, "GoodId": 0, "UnitPrice": 0.0, "Qty": 0.0], ["Id": 0, "GoodId": 0, "UnitPrice": 0.0, "Qty": 0.0], ["Id": 0, "GoodId": 0, "UnitPrice": 0.0, "Qty": 0.0], ["Id": 0, "GoodId": 0, "UnitPrice": 0.0, "Qty": 0.0], ["Id": 0, "GoodId": 0, "UnitPrice": 0.0, "Qty": 0.0], ["Id": 0, "GoodId": 0, "UnitPrice": 0.0, "Qty": 0.0]]
the print() you see above print 4 time becuase I have 4 row!!!
the other problem 2) is that I don't know why it return that much data in each "JACK="
first: I need to know how to use the code outside of the "cellForRowAt" second:why I get thismuch data in "JACK"