Copy info from one row in a table to another row in the same table - Forum - OpenEdge General - Progress Community

Copy info from one row in a table to another row in the same table

 Forum

Copy info from one row in a table to another row in the same table

  • I am looking for a little bit of help. I am needing to copy data the matches certian info from one rom to another row that match different info. here is what I have so far

    define var d-user as c no-undo.

    define var d-user1 as c no-undo.

    for each prod where

    prod.whse = "a"

    no-lock:

    assign

    d-user = prod.prod

    d-user1 = prod.valuea

    .

    for each prod where

    prod.prod = d-user

    and prod.whse = "b"

    exclusive-lock:

    assign

    prod.valuea = d-user1

    end.

    end.

    But this does not work. Any ideas would be very helpfull.

  • DEFINE a new buffer prod-b for prod.

    then do your second FOR EACH using prod-b, like so:

  • Works great. Thank you for the quick response.

  • One might note that one does actually need the variables to hold the values from the first buffer since that buffer is still available, i.e., prod-b.valuea = prod.valuea.

    Consulting in Model-Based Development, Transformation, and Object-Oriented Best Practice  http://www.cintegrity.com

  • true, but we don't know what he left out of his example, and he didn't ask for an optimized version.

  • And the solution obviously worked ... I was just trying to extend the educational experience a bit!

    Consulting in Model-Based Development, Transformation, and Object-Oriented Best Practice  http://www.cintegrity.com