View Single Post
  #3  
Old 17th July 2017, 10:42
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,355
bhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura about
Baan: LN FP 1-9, 10.4, a little bit of Baan IV - DB: SQL Server 2008, Oracle - OS: Windows Server 2008 R2, Unix
Here's the fixed code -

Code:
long ret_val,ret_val2, ret_val3, savepono, ret
domain    tcmcs.str50    savepdno,saveitem,saveqnty
ret_val =  xmlFindFirst  ("ProductionOrderNumber", i.request)
    ret_val2 =  xmlGetData(ret_val, savepdno)

    ret_val3 = xmlGetRightSibling(ret_val)

    select Max(ticst001.pono):savepono
    from ticst001
    where ticst001._index1 = {:savepdno}
    selectdo
    endselect

    while ret_val3 <> 0
    ret_val2 =  xmlGetDataElement(ret_val3, "Item",saveitem)
    ret_val2 =  xmlGetDataElement(ret_val3, "EstimatedQuantity",saveqnty)
    savepono = savepono + 10
    dal.new.object("ticst001")
    dal.set.field("ticst001.pdno", savepdno)
    dal.set.field("ticst001.pono", savepono)
    dal.set.field("ticst001.sitm", saveitem)
    dal.set.field("ticst001.ques", val(saveqnty))
    dal.set.field("ticst001.opno", 10)
    ret = dal.save.object("ticst001")

        if ret = 0 then
            commit.transaction()
        else
            abort.transaction()
        endif
        ret_val3 = xmlGetRightSibling(ret_val3)
    endwhile

Corrections -

1. Use xmlGetData instead of xmlGetDataElement when there is just one element data in a node.
2. ret_val2 was used in xmlGetDataElement which is now corrected to use ret_val3

Hope that works for you. Tested and worked for me.
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote