Importing CSV into Table 5900 (Service Header)

30dirtybirds30dirtybirds Member Posts: 10
Hi All,

Firstly let me say I've been lurking in these forums for the last week or so and using the search have found loads of good fixes for my problems, but this one I couldn't find anything for so I thought I'd say Hi and ask for a spot of help.

I have written an import that should pull info into table 5900 which is the service order header table, at first I wrote it to just do a few fields but the data wasn't importing (no errors just nothing new in the table afterwards)

So I eventually thought the best thing to try was to create an export dataport that throws all the data out so I know its in the correct format etc.

I then edited that file, removing all but 3 or 4 lines and changing each of those lines so that the "No." field would be unique.

I then run the dataport as a import and it seems to run with no errors etc but still no data showing up.

My question is 2 parts, firstly does this table require some additional processing after importing each line? secondly is there some way I could get a status message of each import line?

Thanks in advance for any and all help.
Cheers
Jamie

Comments

  • SavatageSavatage Member Posts: 7,142
    first i would check the 5900 table to see if your imported info is there.

    Maybe the form isn't showing it beacuse a key field is missing.

    another test would be to create a phony service order ->export it out.
    then delete the order and try to import it back in.

    If that works then your dataport is fine and it comes down to those fields you are deleting. perhaps one of them is needed!
  • 30dirtybirds30dirtybirds Member Posts: 10
    Hi Savatage,

    Thanks for the quick reply and help,

    I have checked the 5900 table directly and none of my data is in there.

    The data that is being imported is taken from an exact copy of the exported data and I simply chose to export (and then import) every field from that table so I'm not sure what could be missing.

    I was hoping there was some way of getting an error message/confirmation from it.

    Thanks Again
    Jamie
  • SavatageSavatage Member Posts: 7,142
    Like OnafterGetRecord
    MESSAGE("No.");

    for example for 1 field
  • SavatageSavatage Member Posts: 7,142
    are you importing into variables or directly into the fields. Make sure you've checked off the CallValidate box.
  • 30dirtybirds30dirtybirds Member Posts: 10
    I'm importing directly into tables, although I did try into variables first and had the same problem.

    I think I have found the problem and it is that the "No." field must be in a specific format,

    for example our naming convention creates numbers such as "SMO003990" for a Service Order, if I change the line to "XMO003990" it wont import the line if I change it to "SMO003991" though it does.

    Thanks for all your help

    Savatage, your idea to delete the line instead of changing it was what helped me find the cause. now I need to understand why :)
  • 30dirtybirds30dirtybirds Member Posts: 10
    Another quirky thing is this.

    If I create a Service Order in Navision with the No. AAAAA, export it to a csv file, then delete the Service Order (AAAAA) running the import works. but if I change the name to AAAAB in the text file it doesn't. but if I change it to say SMO003992 it does.

    The data I'm looking to import was data from an old system as so don't really want it having the new naming convention,
  • SavatageSavatage Member Posts: 7,142
    FYI.One thing I like to add to my dataports is some info to be displayed after the procedure is done.
    ImportCount is a variable type Integer
    OnPreDataport()
      ImportCount := 0;
    
    OnAfterImpotRecord()
      ImportCount := ImportCount + 1;
    
    OnPostDataport()
      CurrFile.CLOSE;
      IF CONFIRM('%1 Records Imported / Would You Like To Delete The File?',TRUE,ImportCount)
      THEN
      ERASE(CurrDataport.FILENAME);
    

    Add these anywhere on the specified triggers
  • 30dirtybirds30dirtybirds Member Posts: 10
    Thanks for all the advice,

    I think the second problem I was having is due to a bug where the dataports don't run from within the designer, you have to run them from the object designer view, I happened a across this info in the manual and it seems to have resolved it.

    thanks again!
Sign In or Register to comment.