Dataport problem

ilianadlbilianadlb Member Posts: 40
I have the nex situation:

I have one dataport, where the next code is:


Gen. Journal Line - OnAfterImportRecord()

"Line No." := NextLineNo;
IF "Currency Code"='' THEN BEGIN
TGLSetup.RESET; //TGLSetup is from table General Ledger Setup
TGLSetup.GET();
IF TGLSetup.FIND('-') THEN
CurrencyCode:=TGLSetup."LCY Code";
END ELSE
CurrencyCode:="Currency Code";

VALIDATE("Currency Code",CurrencyCode);

The problem is when the dataport finish any "currency code" is posted in the field currency code in table 81 (Genreal Jornal Line).

Any body know what is happening?
Thanx

Comments

  • kapamaroukapamarou Member Posts: 1,152
    ilianadlb wrote:

    The problem is when the dataport finish any "currency code" is posted in the field currency code in table 81 (Genreal Jornal Line).

    Any body know what is happening?
    Thanx

    Could you explain it more. I don't seem to understand what exactly you mean...
  • SavatageSavatage Member Posts: 7,142
    as above you need to explain more...Where do you expect the imported currency code to go?

    Your dataitem is General Journal Line - isn't it?

    usually a setup table has one value
    TGLSetup.GET();
    IF TGLSetup.FIND('-') THEN

    so the find part might not be necessary.
  • ilianadlbilianadlb Member Posts: 40
    I´m importing a Txt file, in this file I have a "Currency Code"
    I´m trayin to validate this currency code and post this in table 81.
    When my datapot ends to run, any "Currency Code" is posted in my table 81, all the fileds are populate except the "Currency Code" field.

    Do you know what happends whit this field?
  • kapamaroukapamarou Member Posts: 1,152
    Savatage wrote:
    as above you need to explain more...Where do you expect the
    usually a setup table has one value
    TGLSetup.GET();
    IF TGLSetup.FIND('-') THEN
    so the find part might not be necessary.

    Also, when you go with .GET(Primary Key) the RESET is ignored... :D
  • kapamaroukapamarou Member Posts: 1,152
    ilianadlb wrote:
    any "Currency Code" is posted in my table 81, all the fileds are populate except the "Currency Code" field.
    Try to get used to the TERM POST because in NAV it has a different meaning than modify...

    For your problem I think we'll need more info like which fields you fill, which variables you use etc...

    But the power lies in the "Debugger"... :D
  • SavatageSavatage Member Posts: 7,142
    are you sometimes importing a "currency code"?

    Your code is like "if it's blank then get it from the setup table".
    So do you always want to "get it" or sometimes do you "have it"?

    If you sometimes "have it" I would import it into a variable & then validate it.
  • ilianadlbilianadlb Member Posts: 40
    My txt file is:
    //*********************
    0
    7400010025040
    9/23/2008
    0
    JG15
    500.67
    1
    9/2/2008
    XXSA01
    XX25S2
    XXXPST
    K60007
    SA0001
    Purchase of Office Supplies
    SAR
    //**********************
    My Dataport fieds are:
    Enabled SourceExpr StartPos Width
    Yes "Account Type" 0 0
    Yes "Account No." 0 0
    Yes "Posting Date" 0 0
    Yes "Document Type" 0 0
    Yes "Document No." 0 0
    Yes Amount 0 0
    Yes "Gen. Posting Type" 0 0
    Yes "Document Date" 0 0
    Yes "External Document No." 0 0
    Yes InME 0 0
    Yes InCC 0 0
    Yes InProject 0 0
    Yes InICME 0 0
    Yes InICLE 0 0
    Yes InRef 0 0
    Yes Description 0 0
    Yes "Currency Code" 0 0

    I filled some fields with code like, Line No. etc etc,
    In debugger I can watch my information filled correctly, but when I run form 39, I don´t have the field "currency code", I don't get any error, or problem with or withou debbuger...
  • kapamaroukapamarou Member Posts: 1,152
    Are your data being filled correctly? I count 15 fields in your file and 17 Dataport fields.
  • SavatageSavatage Member Posts: 7,142
    Are you validating the other fields at any point????

    How are you achieveing you line no?
    "Line No." := "Line No." +10000;

    Why not type in CurrencyCode into your dataport fields instead of
    "Currency Code"

    Import the info into your variable & then map it back to it's proper field later on.
    Infact I would do this with all the fields. It's very possible a validate from the one of the other fields is clearing your "currency code"
    TGLSetup.RESET;
    IF CurrencyCode='' THEN BEGIN
      TGLSetup.GET();
      "Gen. Journal Line".VALIDATE("Currency Code",TGLSetup."LCY Code");
    END ELSE
      "Gen. Journal Line".VALIDATE("Currency Code",CurrencyCode);
    END;
    

    TGLSetup."LCY Code" does have a value right?
    as per my assumptions of possible causes.

    Also your text file shows 15 fields and your dataport fields you have 17????????????? :-k
  • ilianadlbilianadlb Member Posts: 40
    thanx

    You're right, just I need to have saved the Currency Code value in a global variable, before to execute the Validate.

    Regards
    ilianadlb :D
Sign In or Register to comment.