Count Imported Records - Dataport

Savatage
Member Posts: 7,142
Ok the topic was closed so I had to create a new one.
delete txt file after import
RE: viewtopic.php?t=4449
Answers:
Put the following Code in the OnPost Dataport Trigger
CurrFile.CLOSE;
IF Confirm(Text000, true) then
ERASE(CurrDataport.FILENAME);
Where Text000 = 'Would you like to delete the file?'
OR
CurrFile.CLOSE;
IF Confirm(Text000, true) then
WHILE EXISTS(CurrDataport.FILENAME)
DO ERASE(CurrDataport.FILENAME);
What I would like to do Now is for the Message after the import to say
XXX Orders Imported
Would you like to delete the file?
XXX being the number of records imported
So basically the only change would to get a count on the records?
I'm thinking the count should go on the
OnAfterImportRecord() of the Sales Header Dataitem. Help. Thanks.
delete txt file after import
RE: viewtopic.php?t=4449
Answers:
Put the following Code in the OnPost Dataport Trigger
CurrFile.CLOSE;
IF Confirm(Text000, true) then
ERASE(CurrDataport.FILENAME);
Where Text000 = 'Would you like to delete the file?'
OR
CurrFile.CLOSE;
IF Confirm(Text000, true) then
WHILE EXISTS(CurrDataport.FILENAME)
DO ERASE(CurrDataport.FILENAME);
What I would like to do Now is for the Message after the import to say
XXX Orders Imported
Would you like to delete the file?
XXX being the number of records imported
So basically the only change would to get a count on the records?
I'm thinking the count should go on the
OnAfterImportRecord() of the Sales Header Dataitem. Help. Thanks.
0
Answers
-
Wow, the topic was closed :shock:
Guess we should not have highjacked it
I think best thing to do indeed is to keep somekind of counter in the OnAfterImport trigger
RecCounter := RecCounter + 1;
Another thing you can do is if all imported records have a similar ID or fieldvalue you can filter on this and do a COUNT on the table.0 -
This thing I know is simple but I just can't get it. Even if the # of records imported poped-up in it's own box ie/ Orders Imported: XX with an OK button then the "Would you like to delete the file" POP-Up next then that would be fine
](*,)OBJECT Dataport 50011 Internet Sales Order w Address { OBJECT-PROPERTIES { Date=11/30/05; Time=[ 2:52:00 PM]; Modified=Yes; Version List=HRBiLO,Need; } PROPERTIES { TransactionType=Update; FileFormat=Variable; FieldStartDelimiter="; FieldEndDelimiter="; FieldSeparator=~; OnPostDataport=BEGIN CurrFile.CLOSE; IF CONFIRM(Text0001,TRUE) THEN ERASE(CurrDataport.FILENAME); END; } DATAITEMS { { PROPERTIES { DataItemTable=Table36; ReqFilterFields=Document Type,No.; OnAfterImportRecord=BEGIN "Sales Header".VALIDATE("Sell-to Customer No."); // Internet Begin "Internet Order" := TRUE; // Internet End "Sales Header"."Document Date" := "Order Date"; "Sales Header"."Posting Date" := "Order Date"; "Sales Header"."Shipment Date" := WORKDATE; "Sales Header"."Ship-to Name" := Internet_Cust_Name; "Sales Header"."Ship-to Address" := Internet_Cust_Address1; "Sales Header"."Ship-to Address 2" := Internet_Cust_Address2; "Sales Header"."Ship-to City" := Internet_Cust_City; "Sales Header"."Ship-to State" := Internet_Cust_State; "Sales Header"."Ship-to ZIP Code" := Internet_Cust_Zip; "Sales Header"."Residential Delivery" := Internet_Cust_Residential; "Sales Header"."Internet Order" := TRUE; "Sales Header"."Posting No." := "No."; "Sales Header"."Shipping No." := "No."; END; } FIELDS { { ; ;"Document Type" } { ; ;"No." } { ; ;"Sell-to Customer No." } { ; ;"Customer PO Number" } { ; ;"Order Date" } { ; ;"Shipping Agent Code" } { ; ;"E-Ship Agent Service" } { ; ;Internet_Cust_Residential } { ; ;Internet_Cust_Name } { ; ;Internet_Cust_Address1 } { ; ;Internet_Cust_Address2 } { ; ;Internet_Cust_City } { ; ;Internet_Cust_State } { ; ;Internet_Cust_Zip } } } { PROPERTIES { DataItemTable=Table37; OnAfterImportRecord=BEGIN "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; END; } FIELDS { { ; ;"Document Type" } { ; ;"Document No." } { ; ;Type } { ; ;"Line No." } { ; ;"No." ;OnAfterFormatField=BEGIN VALIDATE("No."); END; } { ; ;Internet_Cust_Qty } { ; ;Internet_Price } } } } REQUESTFORM { PROPERTIES { Width=9020; Height=3410; } CONTROLS { } } CODE { VAR SalesHeader@1000000007 : Record 36; Internet_Cust_Name@1000000000 : Text[30]; Internet_Cust_Address1@1000000001 : Text[30]; Internet_Cust_Address2@1000000002 : Text[30]; Internet_Cust_City@1000000003 : Text[30]; Internet_Cust_State@1000000004 : Text[30]; Internet_Cust_Zip@1000000005 : Code[20]; SalesLine@1000000006 : Record 37; Internet_Cust_Qty@1000000008 : Decimal; Internet_Cust_Residential@1000000009 : Boolean; Internet_Price@1000000010 : Decimal; Text0001@1102606000 : TextConst 'ENU=Would You Like To Delete The File?'; OrderCount@1000000011 : Integer; BEGIN END. } }
0 -
OBJECT Dataport 50011 Internet Sales Order w Address { OBJECT-PROPERTIES { Date=11/30/05; Time=[ 2:52:00 PM]; Modified=Yes; Version List=HRBiLO,Need; } PROPERTIES { TransactionType=Update; FileFormat=Variable; FieldStartDelimiter="; FieldEndDelimiter="; FieldSeparator=~; OnPostDataport=BEGIN CurrFile.CLOSE; IF CONFIRM(Text0001,TRUE,OrderCount) THEN ERASE(CurrDataport.FILENAME); END; } DATAITEMS { { PROPERTIES { DataItemTable=Table36; ReqFilterFields=Document Type,No.; OnAfterImportRecord=BEGIN "Sales Header".VALIDATE("Sell-to Customer No."); // Internet Begin "Internet Order" := TRUE; // Internet End "Sales Header"."Document Date" := "Order Date"; "Sales Header"."Posting Date" := "Order Date"; "Sales Header"."Shipment Date" := WORKDATE; "Sales Header"."Ship-to Name" := Internet_Cust_Name; "Sales Header"."Ship-to Address" := Internet_Cust_Address1; "Sales Header"."Ship-to Address 2" := Internet_Cust_Address2; "Sales Header"."Ship-to City" := Internet_Cust_City; "Sales Header"."Ship-to State" := Internet_Cust_State; "Sales Header"."Ship-to ZIP Code" := Internet_Cust_Zip; "Sales Header"."Residential Delivery" := Internet_Cust_Residential; "Sales Header"."Internet Order" := TRUE; "Sales Header"."Posting No." := "No."; "Sales Header"."Shipping No." := "No."; OrderCount := OrderCount + 1; END; } FIELDS { { ; ;"Document Type" } { ; ;"No." } { ; ;"Sell-to Customer No." } { ; ;"Customer PO Number" } { ; ;"Order Date" } { ; ;"Shipping Agent Code" } { ; ;"E-Ship Agent Service" } { ; ;Internet_Cust_Residential } { ; ;Internet_Cust_Name } { ; ;Internet_Cust_Address1 } { ; ;Internet_Cust_Address2 } { ; ;Internet_Cust_City } { ; ;Internet_Cust_State } { ; ;Internet_Cust_Zip } } } { PROPERTIES { DataItemTable=Table37; OnAfterImportRecord=BEGIN "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; END; } FIELDS { { ; ;"Document Type" } { ; ;"Document No." } { ; ;Type } { ; ;"Line No." } { ; ;"No." ;OnAfterFormatField=BEGIN VALIDATE("No."); END; } { ; ;Internet_Cust_Qty } { ; ;Internet_Price } } } } REQUESTFORM { PROPERTIES { Width=9020; Height=3410; } CONTROLS { } } CODE { VAR SalesHeader@1000000007 : Record 36; Internet_Cust_Name@1000000000 : Text[30]; Internet_Cust_Address1@1000000001 : Text[30]; Internet_Cust_Address2@1000000002 : Text[30]; Internet_Cust_City@1000000003 : Text[30]; Internet_Cust_State@1000000004 : Text[30]; Internet_Cust_Zip@1000000005 : Code[20]; SalesLine@1000000006 : Record 37; Internet_Cust_Qty@1000000008 : Decimal; Internet_Cust_Residential@1000000009 : Boolean; Internet_Price@1000000010 : Decimal; Text0001@1102606000 : TextConst 'ENU=Would You Like To Delete The File?'; OrderCount@1000000011 : Integer; BEGIN END. } }
Making a Internet Interface Harry
I've made 2 changes in your object
And I think you should Initialise the ordercount to 0 in the predataport trigger.
Change your textconstant to
%1 Orders are imported\Would You Like To Delete The File?
Maybe this helps0 -
I'll give it a go.. i tried all this but I didn't Put OrderCount After TRUE. I think that's where I messed up0
-
-
Savatage wrote:Ok the topic was closed so I had to create a new one.
delete txt file after import
RE: http://www.mibuso.com/forum/viewtopic.php?t=4449
[...]
I don't see a "Locked" icon next to that thread, so why do you think it's closed?No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0 -
Luc Van Dyck wrote:Savatage wrote:Ok the topic was closed so I had to create a new one.
delete txt file after import
RE: http://www.mibuso.com/forum/viewtopic.php?t=4449
[...]
I don't see a "Locked" icon next to that thread, so why do you think it's closed?
I tried a few times to add to the post and it just kept kicking me out of it. So I assumed that adding anymore replies to the post was closed especially since it was SOLVED.0 -
Mark Brummel wrote:I hope it works! I did not tested it [-o<
Perfection! \:D/0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions