Baanboard.com

Go Back   Baanboard.com > Forum > Baan SIGs > ION

User login

Frontpage Sponsor

Main

Poll
For ERP LN feature pack upgrade, what method of install are you using?
Installation Wizard into existing VRC
35%
Installation Wizard into new VRC
42%
Manual into existing VRC
3%
Manual into new VRC
19%
Total votes: 31

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 14th July 2017, 11:37
bansaanu bansaanu is offline
Member
 
Join Date: Mar 2010
Posts: 67
bansaanu is on a distinguished road
Baan: BaaN IV and ERP - DB: Oracle - OS: Unix and Window
XML File Parsing

Hi,

I have following structure of the xml file:



Code:
<?xml version="1.0" encoding="UTF-8"?>
<SyncMaterialIssue1 xmlns="http://schema.infor.com/InforOAGIS/2" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" releaseID="2" xsi:schemaLocation="http://schema.infor.com/2.13.x/InforOAGIS http://schema.infor.com/2.13.x/InforOAGIS/BODs/SyncMaterialIssue1.xsd">
   <ApplicationArea>
      <Sender>
         <LogicalID>lid://infor.ln.dev-ln-900</LogicalID>
         <ComponentID>erp</ComponentID>
         <ConfirmationCode>OnError</ConfirmationCode>
      </Sender>
      <CreationDateTime>2017-07-13T14:26:52Z</CreationDateTime>
      <BODID>infor-nid:infor:900:S_900:MN0000001:?MaterialIssue1&amp;verb=Sync</BODID>
   </ApplicationArea>
   <DataArea>
      <Sync>
         <TenantID>infor</TenantID>
         <AccountingEntityID>900</AccountingEntityID>
         <LocationID>S_900</LocationID>
         <ActionCriteria>
            <ActionExpression actionCode="Change" />
         </ActionCriteria>
      </Sync>
      <MaterialIssue1>
         <ProductionOrderNumber variationID="25">MN0000001</ProductionOrderNumber>
         <Lines>
            <Item>KSRMFG002-R</Item>
            <EstimatedQuantity>1</EstimatedQuantity>
            <Operation>10</Operation>
         </Lines>
         <Lines>
            <Item>KSRMFG002-R</Item>
            <EstimatedQuantity>0</EstimatedQuantity>
            <Operation>20</Operation>
         </Lines>
         <Lines>
            <Item>KSRMFG002-R</Item>
            <EstimatedQuantity>0</EstimatedQuantity>
            <Operation>30</Operation>
         </Lines>
         <Lines>
            <Item>KSRMFG002-R</Item>
            <EstimatedQuantity>0</EstimatedQuantity>
            <Operation>40</Operation>
         </Lines>
      </MaterialIssue1>
   </DataArea>
</SyncMaterialIssue1>



I want to read this file so that it reads all production orders and lines under each one of them. I have following code to read the same:


Code:
long ret_val,ret_val2, ret_val3, savepono, ret
domain    tcmcs.str50    savepdno,saveitem,saveqnty


ret_val =  xmlFindFirst  ("ProductionOrderNumber", i.request)
ret_val2 =  xmlGetDataElement(ret_val, "ProductionOrderNumber",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_val, "Item",saveitem)
ret_val2 =  xmlGetDataElement(ret_val, "Quantity",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
But system is not reading ProductionOrderNumber element at all. Also, can you please verify if rest of the other code is fine as well? Can you please suggest if you find any issue?


Thanks,
Anubhav

Last edited by bhushanchanda : 17th July 2017 at 10:25. Reason: added code tags
Reply With Quote
  #2  
Old 15th July 2017, 02:56
pramod pramod is offline
Member
 
Join Date: Jul 2002
Location: Chattanooga, TN
Posts: 38
pramod is on a distinguished road
Baan: B4c4, LN - DB: INF - OS: AIX
First you have read the XML file, it's not there. You can check programmer 's guide for details and syntax.
Reply With Quote
  #3  
Old 17th July 2017, 10:42
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,286
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
  #4  
Old 17th July 2017, 10:47
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,286
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
Also, it's always better to state where you are writing the code for others to understand the issue better. This piece of code seems to be from the Custom BOD where you are manipulating the BOD.

Moved to ION forum.
__________________
Regards,

Bhushan

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


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming Question mr_suleyman Tools Development 37 11th November 2016 08:14
Return value -2 on seq.open mmtmalone Tools Development 2 8th January 2014 22:03
bshell received SIGTERM manojsharma Tools Development 11 5th June 2008 09:22
Problems reading XML file. baanware Tools Development 4 2nd November 2004 12:37
Redirect Print to xml file prajesh Tools Administration & Installation 5 8th July 2002 15:56


All times are GMT +2. The time now is 21:05.


©2001-2017 - Baanboard.com - Baanforums.com