XML Port Problem

bangswitbangswit Member Posts: 265
hi... why everytime I import data from XML file
it only import 1 record (only the last record from xml file)
could anyone give me the information?
thanks

Answers

  • ara3nara3n Member Posts: 9,256
    we need more info.

    such as what is the structure of xml. what is the target table. what fields are being used. what is the PK of the table.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • alok_didaalok_dida Member Posts: 73
    bangswit wrote:
    hi... why everytime I import data from XML file
    it only import 1 record (only the last record from xml file)
    could anyone give me the information?
    thanks

    Do one thing. Open Object Designer.Select Table in it.In that select your Target Table and click button Design. Now go to the Menu and in that select View->Keys and see that you have added proper combination of keys or not. Suppose if there is a only one key and you have a record which have Primary key as a combination of 3 key than it will input only single record for that.

    For Example

    I have a table Vehicle and this is a design for it

    Enabled Field No. Field Name Data Type Length Description
    Yes 10 Model Code 7
    Yes 20 Serial No Code 6
    Yes 30 Description Text 8
    Yes 40 TransmissionText 11
    Yes 50 List Price Integer
    Yes 60 Date of Manufacturing Date

    and i didnt set any keys so bydefault key will be Model.

    I am importing following records
    FIAT 1000 Black 5-Speed 200000 01/31/10
    MAZDA 7500 Blue Automatic 300000 01/15/10
    FIAT 2000 Ivory Automatic 400000 03/31/10
    MAZDA 5500 Red 5-Speed 500000 02/10/10

    In above you can see that i have 4 records but when i am going to import record it will import
    FIAT 1000 Black 5-Speed 200000 01/31/10 and after that
    MAZDA 7500 Blue Automatic 300000 01/15/10
    but when its going to import
    FIAT 2000 Ivory Automatic 400000 03/31/10 you can see that Model is only primary key and with MODEL FIAT is already inserted so it wont insert
    FIAT 2000 Ivory Automatic 400000 03/31/10
    MAZDA 5500 Red 5-Speed 500000 02/10/10 both this record.

    For import all the records i have to set Model,Serial No as my first key.

    Hope you got my point.
  • bangswitbangswit Member Posts: 265
    this is my table
    Enabled Field No. Field Name Data Type Length Description
    Yes 1 sa_out_cd Code 20
    Yes 2 rcp_no Code 20
    Yes 3 bn_dt Text 30
    Yes 4 prod_cd Code 20
    Yes 5 prod_nm Text 30
    Yes 6 sa_qty Decimal
    Yes 7 sa_amount Decimal
    Yes 8 discount Decimal
    Yes 9 TTLAMT Decimal

    the bold one is the key...
    no matter how the data I import
    it only import 1 record... last one
  • alok_didaalok_dida Member Posts: 73
    can you give your some sample data for it?
  • bangswitbangswit Member Posts: 265
    sa_out_cd rcp_no bn_dt prod_cd prod_nm sa_qty sa_price sa_amount discount
    UM 526 1 9430013IZ--BU U.R.S & inc. 1 30.9 30.9 6.18
    UM 527 1 3904014PZ--BL U.R.S & inc. 1 35.9 35.9 0
    UM 528 1 3801032PZ--WH U.R.S & inc. 1 43.9 43.9 8.78
    UM 529 1 3902007PZ--RD U.R.S & inc. 1 29.9 29.9 5.98
    UM 530 2 3804013SZ--KH U.R.S & inc. 1 49.9 49.9 9.98
    UM 530 3 3801064CZ--BL U.R.S & inc. 1 39.9 39.9 21.95

    this is the sample data
  • bangswitbangswit Member Posts: 265
    I already tried change the keys
    to be prod_cd
    but it still the same...I only could import 1 record

    by the way,the export is the sample... no matter how many records..only export 1 record
  • alok_didaalok_dida Member Posts: 73
    Are you importing XML file or Text file?

    If it is text file than is it Variable or fixed?
  • bangswitbangswit Member Posts: 265
    alok_dida wrote:
    Are you importing XML file or Text file?

    If it is text file than is it Variable or fixed?

    I import xml file
    here is the sample data

    <Data>
    <detail sa_out_cd="UM" bn_dt="2010-05-01T00:00:00" rcp_no="000526" prod_cd="9430013IZ--BU" prod_nm="U.R.S & inc." sa_qty="1.0000" sa_amount="30.9000" discount="6.1800" TTLAMT="535.9000" />
    <detail sa_out_cd="UM" bn_dt="2010-05-01T00:00:00" rcp_no="000527" prod_cd="3904014PZ--BL" prod_nm="U.R.S & inc." sa_qty="1.0000" sa_amount="35.9000" discount="0.0000" TTLAMT="450.0000" />
    <detail sa_out_cd="UM" bn_dt="2010-05-01T00:00:00" rcp_no="000528" prod_cd="3801032PZ--WH" prod_nm="U.R.S & inc." sa_qty="1.0000" sa_amount="43.9000" discount="8.7800" TTLAMT="528.8000" />
    <detail sa_out_cd="UM" bn_dt="2010-05-01T00:00:00" rcp_no="000529" prod_cd="3902007PZ--RD" prod_nm="U.R.S & inc." sa_qty="1.0000" sa_amount="29.9000" discount="5.9800" TTLAMT="468.6000" />
    </Data>
  • alok_didaalok_dida Member Posts: 73
    bangswit wrote:
    alok_dida wrote:
    Are you importing XML file or Text file?

    If it is text file than is it Variable or fixed?

    I import xml file
    here is the sample data

    <Data>
    <detail sa_out_cd="UM" bn_dt="2010-05-01T00:00:00" rcp_no="000526" prod_cd="9430013IZ--BU" prod_nm="U.R.S & inc." sa_qty="1.0000" sa_amount="30.9000" discount="6.1800" TTLAMT="535.9000" />
    <detail sa_out_cd="UM" bn_dt="2010-05-01T00:00:00" rcp_no="000527" prod_cd="3904014PZ--BL" prod_nm="U.R.S & inc." sa_qty="1.0000" sa_amount="35.9000" discount="0.0000" TTLAMT="450.0000" />
    <detail sa_out_cd="UM" bn_dt="2010-05-01T00:00:00" rcp_no="000528" prod_cd="3801032PZ--WH" prod_nm="U.R.S & inc." sa_qty="1.0000" sa_amount="43.9000" discount="8.7800" TTLAMT="528.8000" />
    <detail sa_out_cd="UM" bn_dt="2010-05-01T00:00:00" rcp_no="000529" prod_cd="3902007PZ--RD" prod_nm="U.R.S & inc." sa_qty="1.0000" sa_amount="29.9000" discount="5.9800" TTLAMT="468.6000" />
    </Data>


    Hey bangswit

    Its able to import all the records in my table. I get parsing error before, because of '&' in prod_nm="U.R.S & inc." and after removing it when i try to import records its working fine.
  • bangswitbangswit Member Posts: 265
    alok_dida wrote:
    bangswit wrote:
    alok_dida wrote:
    Are you importing XML file or Text file?

    If it is text file than is it Variable or fixed?

    I import xml file
    here is the sample data

    <Data>
    <detail sa_out_cd="UM" bn_dt="2010-05-01T00:00:00" rcp_no="000526" prod_cd="9430013IZ--BU" prod_nm="U.R.S & inc." sa_qty="1.0000" sa_amount="30.9000" discount="6.1800" TTLAMT="535.9000" />
    <detail sa_out_cd="UM" bn_dt="2010-05-01T00:00:00" rcp_no="000527" prod_cd="3904014PZ--BL" prod_nm="U.R.S & inc." sa_qty="1.0000" sa_amount="35.9000" discount="0.0000" TTLAMT="450.0000" />
    <detail sa_out_cd="UM" bn_dt="2010-05-01T00:00:00" rcp_no="000528" prod_cd="3801032PZ--WH" prod_nm="U.R.S & inc." sa_qty="1.0000" sa_amount="43.9000" discount="8.7800" TTLAMT="528.8000" />
    <detail sa_out_cd="UM" bn_dt="2010-05-01T00:00:00" rcp_no="000529" prod_cd="3902007PZ--RD" prod_nm="U.R.S & inc." sa_qty="1.0000" sa_amount="29.9000" discount="5.9800" TTLAMT="468.6000" />
    </Data>


    Hey bangswit

    Its able to import all the records in my table. I get parsing error before, because of '&' in prod_nm="U.R.S & inc." and after removing it when i try to import records its working fine.

    yes, I also succeed
    i just change the sequance of xml port
    thanks a lot :)
  • alok_didaalok_dida Member Posts: 73
    what was the problem?
    Change the sequence of XMLPort.. I didnt get you.
  • bangswitbangswit Member Posts: 265
    alok_dida wrote:
    what was the problem?
    Change the sequence of XMLPort.. I didnt get you.

    FIRST
    TagName TagType SourceType DataSource
    Data Element Table Sample (EASIPOS)(Sample (EASIPOS))
    detail Element Text <detail>


    and then I change to be like this

    TagName TagType SourceType DataSource
    Data Element Text <Data>
    detail Element Table Sample (EASIPOS)(Sample (EASIPOS))
Sign In or Register to comment.