Pulling data out of an element in an array
Here's my data
"LineInformation": [
{
"AssignedNumber": "000001",
"itemDetail": [
{
"orderstatus": "CC",
"OrderedQuantity": "112",
"ShippedQuantity": "112",
"QuantityDifference": "0",
"UOM": "CA",
"UPCCaseCode": "002110001505",
"QualifierVN": "VN",
"ItemNumber": "01505",
"Lot": "L/03698P",
"NetWgt": "840.00",
"NetWgtQ": "N",
"NetWgtU": "L",
"GrsWgt": "840.0",
"GrsWgtQ": "G",
"GrsWgtU": "L",
"UPC2": "",
"QualifierPD": "",
"InventoryLevel3": "",
"LineChangeReasonCode": "",
"WhseDtAdjID": "",
"QualifierZZ": "",
"InventoryLevel4": "",
"ReasonCode": "",
"ExpiryDate": "",
"Level2": "20270830",
"ItemDescription": "12/7.5OZ DBLQ RED USA-WILD",
"AlternateItemDesc": "",
"ExtendedDesc": ""
},
{
"orderstatus": "CC",
"OrderedQuantity": "243",
"ShippedQuantity": "243",
"QuantityDifference": "0",
"UOM": "CA",
"UPCCaseCode": "002110002514",
"QualifierVN": "VN",
"ItemNumber": "02514",
"Lot": "2400A512",
"NetWgt": "6439.50",
"NetWgtQ": "N",
"NetWgtU": "L",
"GrsWgt": "6439.5",
"GrsWgtQ": "G",
"GrsWgtU": "L",
"UPC2": "",
"QualifierPD": "",
"InventoryLevel3": "",
"LineChangeReasonCode": "",
"WhseDtAdjID": "",
"QualifierZZ": "",
"InventoryLevel4": "",
"ReasonCode": "",
"ExpiryDate": "",
"Level2": "20280830",
"ItemDescription": "24/14.75OZ DBLQ PINK USA-WILD",
"AlternateItemDesc": "",
"ExtendedDesc": ""
}
]
}
],
The Shipped Quantity is the number of Eaches and I'm attempting to calculate the number of Cases. The conversion factor is the part of the ItemDescription before the /.
I tried to get the substring of ItemDescription to do the math part in a separate step, but I'm having trouble getting just one value per iteration.
Can someone help me find a way to accomplish this?
0
Comments
Jack Harris I usually have good success with Celigo AI on things like this. Here is what it made and here is my prompt. Just be fairly specific on the ask and see what it comes up with.
Prompt:
I need to calculate the number of cases for each item detail. To do so, I need the shipped quantity which is the number of eaches and the conversion factor is the set of numbers before the first slash in the itemdescription. Can you help out?
Code:
Thank you,
I've had hit-or-miss results with the AI, but it worked out this time. Thank you for the assistance!
Please sign in to leave a comment.