Dataports aren't my thing but here goes... #-o
I have a dataport where i want to import a Sales Header & Sales Line info.
It works fine right now, BUT
With the imported data is different SHIP-TO information. Every Cust # is 1234 but the ship-to info is different for every one.
in order to get the customer's complete info in the header I put a VALIDATE("Sell-To Customer No."); on the OnAfterImportRecord of the Sales Header Dataitem.
The problem with this is it put's back the original SHIP-TO INFO for that customer and doesn't keep the imported data.
If I eliminate the VALIDATE line then the ship to data stays but the rest of the customer info is not filled in.
any simple answers out there? I guess I can make two Sales Header Dataitems and have the 2nd import the ship-to address but I figured there has to be another way.
Thanks.
0
Comments
name
address
address2
city
st
zip
on every sales order.
These are internet orders so the address could be from anyone/anywhere. We are being a fullfillment center for one customer. So we want to enter the customers number but have the ship-to go whomever ordered the merch over the net.
We were importing the shipping data into eship which is easy to do - but now we are trying to do an order data feed instead of a shipping data feed. This will enable us to do 3rd party billing for UPS a little easier.
http://www.BiloBeauty.com
http://www.autismspeaks.org
If it is in the input record, and it comes 'before' the Ship-to Address fields, then go to the Dataport Fields dialog and set the 'CallFieldValidate' property of the "Sell-to Customer No." field to 'Yes'. Here's a snip from the on-line help for this property, that speaks directly to your issue: (Remember to remove the VALIDATE code from the OnAfterImportRec trigger.)
If the value used is 'constant', then put your code in the OnBeforeImportRec -- probably INIT; followed by VALIDATE("Sell-to Customer No.", constValue);...
RIS Plus, LLC
I have to import sales header & sales line from an excel file (dataport) to
Navision.
Do you have a dataport?
My question is:
1.) Do I need to supply the invoice no. or is it possible the system creates the no., when the customer no. changes?
Your help would be really appreciated.
Thanks,
Stefanie
Look into Dataport Fields, and go to Show/Hide columns. Show the column "CallFieldValidate". If you check this field, the field will be automatically validated, and if the Sell-to field is before the Ship-to fields, all will be OK (the Customer will be validated first and than all info for ship to will be imported)
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
So that's why I went with the code. I also read a post or two where other people had the same problem with the CallField Validate not working properly.
but I will try it again..maybe I missed something - Thanks
http://www.BiloBeauty.com
http://www.autismspeaks.org
First, you add global text variables for your ship-to fields, so let's say you have MyShipToAddress, and MyShipToCity. Of course you will have more than just two of them, but this is just an example right .
Second, you enter these variables into the Field Designer of the dataport, instead of the actual field names of the sales table. All you need to do is handle setting the values in code. Just keep the field "Sell-to Customer No." field in the Field Designer, we'll force the validation later.
Third, in the OnAfterImportRecord (which fires before the record is modified), you code the following. It's important here that you do the validation first and the ship-to fields later, since the Sell-to validation also sets the ship-to information. As you already know, the CallValidation doesn't always work, and because it's hard to predict when, I always just program this kind of stuff right away, saves me a lot of time . The MODIFY should not be necessary, since the dataport is supposed to do that, so you may want to try it without and test it.
RIS Plus, LLC
The Variables seems to be the best way to go. Now with this little bit of knowledge I can fix all those dataport projects that have been sitting on the side!
CallFieldValidate nice idea if it was reliable :?
Thanks O:)
http://www.BiloBeauty.com
http://www.autismspeaks.org
I'm helping a customer with their data migration as it so happens, so I am running into these issues myself. I found that the autoupdate/save/replace doesn't really work either, for some reason I just can't get a dataport to update any records, so I put some code in there as well. At the end of the OnAfterImport trigger, you put this in: Of course replace the SalesHeader part with whatever dataitem you are working with.
If the properties don't work then we have more compelling arguments huh
RIS Plus, LLC
This code is not good if you have big amount of data for import (on MS SQL). Because it will execute Insert statement for each line which is much more time consuming than Modify (update statement). Faster is to use get to know if the record exist or may be use
But it depend on possibility of inserting new records or modifying old during the import process.
And the variable solution is common. In "advanced" programming no "standard" dataports exists (I never used dataport without C/AL code). And do not forget, that if you run dataport directly from designer (when you are designing the dataport), it will not commit the changes into database. Run it from object designer instead...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.