Deserialize issue

My Requirement:
Read excel and group by Reference_PO_Number and rows of unique PO’s under one transaction item
Data: Example data below, here we should group by Referece_PO and add unique values under 1 queue item

NC_Number RMA_Number Part_Number Return_Part_Number Reference_PO_Number
xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx 1
xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx 1
xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx 2
xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx 3
xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx 3
xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx 3

Approach I followed:
Dispatcher:::

  1. GroupPO_reference and assign to below type
    System.Collection.Generic.IEnumerable<System.Linq.IGrouping<System.Object,System.Data.DataRow>>

  2. Loop GroupPO_reference
    a. Copy each item of the loop to data table lets say DT1
    b. Serialize
    JsonConvert.SerializeObject(DT1) and assign to stringValiable1
    c. Add to Queue - stringValiable1
    Performer:::
    DataTable = JsonConvert.DeserializeObject(Of DataTable)(TransactionItem.SpecificContent(“stringValiable1”).ToString)
    Issue :
    For some of the data getting exception in De-serializing
    Exception- Error converting value “” to type ‘System.Double’

Example data where I faced issues:
Issue1:
====Price Issue Blank -Assign: Error converting value “” to type ‘System.Double’. Path ‘[1].Price’, line 1, position 1048.
[{“CreationDateAndTime”:“02/06/2025 21:31:41”,“Region”:“xx”,“NC_Number”:“A000xxxxx-1”,“RMA_Number”:“Test11111”,“Part_Number”:“04xx71A”,“Return_Part_Number”:“”,“Quantity”:1.0,“Delivery_Date”:“04.15.2025”,“Serial_Number”:123xx6.0,“Stock_Type”:“Xxxx”,“Plant”:7005.0,“Cost_Center”:“”,Price":0.0, “Reference”:1.0},{“CreationDateAndTime”:“02/06/2025 21:31:41”,“Region”:“xx”,“NC_Number”:“A0xxx498”,“RMA_Number”:“”,“Part_Number”:“045xx71A”,“Return_Part_Number”:“”,“Quantity”:1.0,“Delivery_Date”:“”,“Serial_Number”:45xx.0,“Stock_Type”:“Rxx1”,“Plant”:80xx.0,“Cost_Center”:“”,“Price”:“”,“Reference”:1.0 }]
Issue2:
Failed converting in ====RMA_Number Issue :: Assign: Error converting value “גכc” to type ‘System.Double’. Path ‘[1].RMA_Number’, line 1, position 850.

[{“CreationDateAndTime”:“02/07/2025 00:58:49”,“Region”:“xx”,“NC_Number”:“S23s23xxx-1”,“RMA_Number”:33xx4.0,“Part_Number”:“08xxxx8-003”,“Return_Part_Number”:“011xx-003”,“Quantity”:1.0,“Delivery_Date”:“”,“Serial_Number”:“vvv 123”,“Stock_Type”:“xx1”,“Reference”:2.0},{“CreationDateAndTime”:“02/07/2025 00:58:49”,“Region”:“xx”,“NC_Number”:“S00xxxx5-1”,“RMA_Number”:“xx”,“Part_Number”:“01xxx-000”,“Return_Part_Number”:“08xxxx69-000”,“Quantity”:1.0,“Delivery_Date”:“”,“Serial_Number”:“hgjk”,“Stock_Type”:“ccc”,“Reference”:2.0}]

@syed.khaja

instead of serializing and addign and all…you can just add the po number to queue and read the data and filter with po number to get all rows

or before serializing make sure all the columns are casted to string type and then convert…

cheers

Thank you @Anil_G , i have added the reference and file name with path to Queue . In Performer i am filtering it and consuming the data accordingly.
Thanks.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.