Dataport (again)

Jan01Jan01 Member Posts: 9
Hello community,
I have a question about creating a dataport, I didn´t find anything related to my problem in the forum.search.

I have a .csv file from excel with 3 columns and I want to
import the data from the 3 columns in the first three colums from the customer-table.

I created a dataport with data-item "customer", I set the separation to ;

but, when I start the port, nothing happens. I can only CANCEL the port.

can someone with more experience help me ?

Thanks very much.

best regards,

Jan

I don´t need any signatures...

Comments

  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Did you add the first 3 fields in the Dataport field-List (Use menu View -> Dataport Fields) ?
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • Jan01Jan01 Member Posts: 9
    Hello,

    yes, the fields were set, but the marker "enable" was not set, that was the problem. Now it works, but
    I have another question,
    now i imported the 3 columns in the customer-table, and I want to give every imported record a "primary contact no." automatically from the defined no.series .
    How can I do this ?

    I tried
    "Primary Contact No." :='';
    INSERT(TRUE);
    

    in the Customer - OnAfterImportRecord()

    but I get a error-message "customer ..... already exists" (..... = number from the no.series)

    what can I also try ?

    thanks a lot.


    Jan

    I don´t need any signatures...
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    I think you confuse the Primary contact no with the primairy Key.


    This is the No. field

    Look at the OnInsert trigger of the Customer Table.
  • Jan01Jan01 Member Posts: 9
    Hello,

    no, i want to give every imported customer a primary contact no.
    (field no. 5049 in the customer table) automatically.
    the primary key is the no. , that´s clear.

    thanks,

    Jan

    I don´t need any signatures...
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    I think I do not understand you, do you want to create a contact for the customer?
  • Jan01Jan01 Member Posts: 9
    Hello,

    ok I see, I must choose another way, no problem..

    But, now I have a problem with the no. series for the customer-no.
    I defined a no. series for customer, and I imported some customes by dataport. But now i want to create a customer manually. Navision reported an error, that the no. 10002 (a no. from the series, but used by the import) already exists.

    How can I tell the system to take a new, not used number from the series.

    thanks,

    Jan

    ( I know a löot of questions today, but i am a bloody beginner..;-) )

    I don´t need any signatures...
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    It is not bad to be a beginner, we all started out that way :D

    If you enter a customer number before the insert the numberseries will not be triggered.
    Cust."No." := 'AAA';
    Cust.INSERT(TRUE);
    

    Will insert a customer with the number AAA

    You need ofcourse to make some fuction to create a number yourself because you cannot create more than one customer AAA.

    You can also include the "No." in the dataport fields.
  • Jan01Jan01 Member Posts: 9
    Ok, but, for example I have a no. ser. from 10000 to 12000
    and i have a csv table liek this:
    10000;CustomerA;CustomerAdressA
    10001;CustomerB;CustomerAdressB
    10002;......
    
    

    and I start the import, I have customers with this no. in the table,
    but when I create a customer manually with numbers from the no.series.
    Then I get the message, that the customer-no. 10000 already exists.

    so how can I manage it, that when I create a customer manually, the number 10003 will be taken ?

    (because 10000 - 10002 is already used by the customers I imported)


    thanks

    Jan

    I don´t need any signatures...
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    I hope I understand you. :D

    If you go to the numberseries of the customer (Via Sales & Receivables Setup) you see there a field Last No. Used (or something like that)

    You should set this to 10002. This means the next no. is 10003.
  • Jan01Jan01 Member Posts: 9
    Hello,

    ah yes, that´s the right thing, thanks,
    can I set the field "last no. used" automatically to the last used no from the customer tabel, or must I set the no manually ?

    I don´t need any signatures...
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    It is set automaticaly if you create a new customer.
  • Jan01Jan01 Member Posts: 9
    And that is the problem.

    I imported the 2 customers by dataport (no. 10000 - 10002)
    and then i want to create a customer by customer-card,
    but the counter "last no used" is still on 10000

    so when i create a new customer, nav. tell me that the no. 10000 is already used..

    I don´t need any signatures...
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    In this case then you can reset it manualy, or write some code in the dataport which does the update.

    You can also still make the dataport use the no. series, then you won't have to go through all this trouble.
  • Jan01Jan01 Member Posts: 9
    Hello,

    thanks a lot,

    I think for our work it´s ok to do it manually because it is a dataport,
    which will be only used one time to import customers from another database.

    Thanks for your help.

    Jan

    I don´t need any signatures...
  • jesterchrisjesterchris Member Posts: 21
    Any hints on how to make a dataport use No. Series? I'm having trouble figuring it out.
  • SavatageSavatage Member Posts: 7,142
    Do you really need a number series or do you need an "Auto increment line no" for example?
  • jesterchrisjesterchris Member Posts: 21
    I could use both actually. I'm fairly new to Navision and I'm not a veteran programmer. I do have some programming skills but I do not have much real world experience.
  • SavatageSavatage Member Posts: 7,142
    I guess there are a bunch of ways to accomplish it.

    For Example#1: (Creating a number that's always differnet)
    I import Vendor credits once a month into the Gen Journal Line.
    So the day isn't important for me
    So each "Document No" I need to have different for every vendor for every month and I wanted to auto generate the #.

    OnAfterImpotRecord()
    VenNo := "Account No.";
    MonthName := FORMAT(TODAY,0,'<Month Text,3><Year>');
    "Document No." := VenNo+'-'+MonthName;

    So a credit for Feb 2006 for vendor 111131
    the "Document No."would look like
    111131-FEB06

    This can be shortend but I wanted it to be clear

    For Example #2 (creating a running #)
    Lets say I wanted to count the number of credits

    OnPreDataItem()
    CreditCount := 0;
    OnAfterImportRecord()
    CreditCount := CreditCount + 1;

    This is a very easy way of creating a number increment using imported data.

    You can get creative depening on your needs. Hope those two examples can help you get the ball rolling. I'm sure everyone has their own favorite way. I hope everyone posts their's. Could get interesting.
  • SavatageSavatage Member Posts: 7,142
    I could use both actually. I'm fairly new to Navision and I'm not a veteran programmer. I do have some programming skills but I do not have much real world experience.

    Here's a download you can play around with
    Dataport Generator v1.1
    http://www.mibuso.com/dlinfo.asp?FileID=360
  • jesterchrisjesterchris Member Posts: 21
    Thank you that is helpful. How about using No. Series. I'm sure that is a bit more work.
  • SavatageSavatage Member Posts: 7,142
    I've never had a need myself - so I haven't tested anything. I wonder if you set the No Series in a Journal Batch name if it auto fills that field by itself when using a dataport? I'll test it when I get a chance.

    What are you trying to fill?

    Another example is we receive internet orders that we fill. The orders are imported into Navision thru a dataport. The order numbers sent to us are always different so we decided to keep those internet order numbers as our order #'s, we just added a INT to the beginning of it Just to be sure they don't clash with our own internal order numbers. (INT1234567) the dataport code takes care of that too.
  • jesterchrisjesterchris Member Posts: 21
    Sorry for the delay in response I've been a bit overwhellmed with work/life lately. I'm trying to migrate historical data into the DonorVision module. Today table 37001266 Constituent Journal Line. The simple auto number is working fine for now. I do appreciate your help/advise.
Sign In or Register to comment.