Code for adding order number to collection

Hi, I have only minimal experience with coding but I need to add the systemic order numbers of purchases to the right column in my collection. The cartId is saved already, so by fetching it and finding the matching row that should work.
Can anyone help me with writing the code please?
Thanks a lot!

Is this not a duplicate of your previous thread?

Brief sytanx, not sure what language or semantics, but this should help:

SuccessfulPurchase = (InventorySold +1)

Assign the variable to the new value you wish to use/display

SuccessfulPurchase = Number Of Shirts Sold

Once you have established the variable to represent the items sold, start with an initial value (0) then set the logic to add what ever number of the item is sold to that initial value.