I want to import txt files with a dataport and then use autonumber. But the problem is when I use autoincrement in my table and there are more lines in the text file the line are overwritten. Can someone help me?
I want to import txt files with a dataport and then use autonumber. But the problem is when I use autoincrement in my table and there are more lines in the text file the line are overwritten. Can someone help me?
ThanX
The autonumber field is integer with autoincrement. In the dataport i wrote some code:
IF msgInfo.FIND('+') THEN
msgInfo."Nr." := msgInfo."Nr." + 1
ELSE
msgInfo."Nr." := 1;
INSERT(TRUE);
="ROBO
The autonumber field is integer with autoincrement. In the dataport i wrote some code:
IF msgInfo.FIND('+') THEN
msgInfo."Nr." := msgInfo."Nr." + 1
ELSE
msgInfo."Nr." := 1;
INSERT(TRUE);
1) What trigger are you using.
2) Everytime it hits "ELSE" the number is "1" overwriting the previous "1" are you sure it's finding anything?
3) What table are you trying to bring this into?
="ROBO
The autonumber field is integer with autoincrement. In the dataport i wrote some code:
IF msgInfo.FIND('+') THEN
msgInfo."Nr." := msgInfo."Nr." + 1
ELSE
msgInfo."Nr." := 1;
INSERT(TRUE);
1) What trigger are you using.
2) Everytime it hits "ELSE" the number is "1" overwriting the previous "1" are you sure it's finding anything?
3) What table are you trying to bring this into?
1) it's a dataport that must import text files (single line and multiline). After the import it delete the file.
2) I want to find the last number that is used
3) It is a self made table with "nr." as key (integer) this is the field i want the autonumber apply's to.
2) I want to find the last number that is used
3) It is a self made table with "nr." as key (integer) this is the field i want the autonumber apply's to.
Use this system:
Dataport - OnPreDataport():
msgInfo.RESET;
IF msgInfo.FIND('+') THEN
intLastUsedNo := msgInfo."Nr.";
OnAfterImportRecord();
intLastUsedNo += 1;
Like this, you do the read for the last one only once.
Regards,Alain Krikilion No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
It imports the txt file but the line's get overwritten when its a multiline txt file. Do you have a solution for that also?
Thanx a lot
In case you do the INSERTS yourself, when you start to fill (in general just after INIT or CLEAR of the record) a new record to be written, put the code I gave you.
Regards,Alain Krikilion No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
I think your dataport is mixing up the variables, or it's not setting the number in the right trigger. To take the whole thing into your own hands, you can import your text file into variables instead of the fields of your table directly, and then write the code to insert the records using the values of the variables.
I think your dataport is mixing up the variables, or it's not setting the number in the right trigger. To take the whole thing into your own hands, you can import your text file into variables instead of the fields of your table directly, and then write the code to insert the records using the values of the variables.
where you enter fields into the dataport fields editor, you can also enter variable names. Then in the OnAfterImportRecord trigger you handle the values.
I think your dataport is mixing up the variables, or it's not setting the number in the right trigger. To take the whole thing into your own hands, you can import your text file into variables instead of the fields of your table directly, and then write the code to insert the records using the values of the variables.
"Sales Line"."EDI Item Cross Ref." := Internet_Cust_Orig_Item;
Importing the data into vaiables & then assigning them to it's proper Navision Field OnAfterImportRecord, as Denster stated, always solves my dataport problems
Comments
I think you will either need to write some code or add the number to your importfile.
But you can do
OnPreDataItem()
"Line No." := 1;
OnAfterImportRecord()
"Line No." := "Line No." + 1;
:?: :?: :?:
http://www.BiloBeauty.com
http://www.autismspeaks.org
The autonumber field is integer with autoincrement. In the dataport i wrote some code:
IF msgInfo.FIND('+') THEN
msgInfo."Nr." := msgInfo."Nr." + 1
ELSE
msgInfo."Nr." := 1;
INSERT(TRUE);
1) What trigger are you using.
2) Everytime it hits "ELSE" the number is "1" overwriting the previous "1" are you sure it's finding anything?
3) What table are you trying to bring this into?
http://www.BiloBeauty.com
http://www.autismspeaks.org
1) it's a dataport that must import text files (single line and multiline). After the import it delete the file.
2) I want to find the last number that is used
3) It is a self made table with "nr." as key (integer) this is the field i want the autonumber apply's to.
Thanx for your help
But the field is a BigInteger, and not an integer.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Use this system:
Dataport - OnPreDataport():
OnAfterImportRecord();
Like this, you do the read for the last one only once.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
It imports the txt file but the line's get overwritten when its a multiline txt file. Do you have a solution for that also?
Thanx a lot
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
RIS Plus, LLC
I never did this is there an example for this?
RIS Plus, LLC
This is what I did on post: (As an example)
http://www.mibuso.com/forum/viewtopic.php?t=9631
I set it before anything happens & bring it back later
OnAfterImportRecord()Code:
Internet_Cust_Orig_Item := "No.";
Item.GET("Sales Line"."No.");
IF Item.Blocked THEN
BEGIN
"Sales Line"."No." := '99904';
END;
"Sales Line".VALIDATE("No.");
"Sales Line"."Qty. Ordered" := Internet_Cust_Qty;
"Sales Line".Quantity := Internet_Cust_Qty;
"Sales Line".VALIDATE("Qty. Ordered");
"Sales Line"."EDI Unit Price" := Internet_Price;
"Sales Line"."EDI Item Cross Ref." := Internet_Cust_Orig_Item;
Importing the data into vaiables & then assigning them to it's proper Navision Field OnAfterImportRecord, as Denster stated, always solves my dataport problems
http://www.BiloBeauty.com
http://www.autismspeaks.org
ThanX again
Veel plezier ermee
RIS Plus, LLC
CLEAR(Rec);
Your autoincrement field will then work fine.
Jonathan