Tuesday, 11 October 2016

XML : Import XML to Access and keep relationships also update database from same XML file,

I am building a program for work that we will use to keep track of buses that come through our bodyshop.

We already have one piece of software which we use for recording and calculating our pain mixes, unfortunately, this software doesnt allow us to record parts and labour, hence my program.

The paint software that we use does have the functionality to export data for use in other software, however it does this to an XML file.

  <?xml version="1.0" encoding="UTF-8"?>  <PPG>  <Header>  <Protocol>  <Message>MixDataInterface</Message>  <Name>PPG</Name>  <Version>1.3.0</Version>  </Protocol>  <Transaction>  <TransactionID>77c8f032-da3b-45c0-ae50-f95d2de7dd1b</TransactionID>  <TransactionDate>2016-10-11T13:16:12</TransactionDate>  </Transaction>  <ShopInfo>  <PPGShopID />  <ShopID>DB</ShopID>  <ShopName>TRAXX</ShopName>  </ShopInfo>  </Header>  <MixDataInterface>  <ROData>  <ROCount>3</ROCount>  <RepairOrders>  <RO>  <ROCounter>1</ROCounter>  <RONumber>UNASSIGNED</RONumber>  <Notes />  <Undercoat>False</Undercoat>  <Clearcoat>False</Clearcoat>  <Basecoat>True</Basecoat>  <TotalLiquidCost>0.00</TotalLiquidCost>  <TotalSundryCost>0.00</TotalSundryCost>  <MixCount>1</MixCount>  <Mixes>  <Mix>  <MixCounter>1</MixCounter>  <MixRONumber>UNASSIGNED</MixRONumber>  <MixedDate>2016-10-05T00:00:00</MixedDate>  <MixedBy />  <MixedByEmployeeID />  <MixCost>0.00</MixCost>  <PPGBrandCode>7EFBB</PPGBrandCode>  <ColorMixDescription>AQUABASE PLUS (AQU+ BC Solid) 7EFBB Prime (BIANCO BIANCO , BIANCO NEVE)</ColorMixDescription>  <FormulaType>Standard</FormulaType>  <ComponentCount>4</ComponentCount>  <Components>  <Component>  <ComponentCounter>1</ComponentCounter>  <ComponentRONumber>UNASSIGNED</ComponentRONumber>  <ComponentCode>P990-8900</ComponentCode>  <ComponentDescription>BRILLIANT WHITE</ComponentDescription>  <ComponentCost>0.00</ComponentCost>  <ComponentWeightApplied>0.00000</ComponentWeightApplied>  <ComponentWeightTarget>179.30470</ComponentWeightTarget>  <ComponentDensity>1.21300</ComponentDensity>  </Component>  </Components>  </Mix>  </Mixes>  <SundryCount>0</SundryCount>  </RO>  </RepairOrders>  </ROData>  </MixDataInterface>  </PPG>    

I have tried importing the XML file into access and it works, creating the 7 tables shown here XML Tables the red arrows drawn onto the image indicate the relationships that I think should exist between the tables.

I have looked at both How to import XML with layers of nested nodes (parent/child/child relationships) into Access? and https://stackoverflow.com/questions/30029303/how-to-import-xml-with-nested-nodes-parent-child-relationships-into-access#= but I'm not sure I understand what to do in regards to my own XML file.

Also once I get this imported, is it possible to have it update on a regular basis? As it stands when I import it a seconf time and select the @Appened data to existing tables@ option, it create a duplicate of all information previously imported, but I only want it to add new data.

No comments:

Post a Comment