Hi all,
This post of mine is regarding the validation of required fields in a table while importing data through dataports.
Actually I am importing the purchase order data in to NAV 4.0sp2 from posted invoices of NAV 3.7 version. I am struck at how to find what are all the fields to be validated and the exact order in which the fields are to be validated in a particular table. This is because even if I am adding code for validating some fields like (Location Code, ShortcutDimensionCode1..etc) fields, without those fields getting validated, the data is being inserted in to the purchase header table. So just needed to know whether any way to have an exact order of list of fields to be validated by any manner???? As "CallFieldValidate" doesnt work for me I am validating thru "OnAfterImportRecord" trigger.
And my second doubt is like "Is it necessary that the order in which we specify the dataport fields and the order of the validation that we pose on fields in the "OnAfterImportRecord" trigger need to be same?"
It would be very grateful If I could get some suggestions from U all..
Thanks in advance..
Dilip
Falling down is not a defeat..defeat is when you refuse to get up.
0
Comments
If you are doing you own validation in the OnAfterImport trigger, then the order is less important since you are most likely importing into variables and then using those values to validate the table record fields.
To determine the order of validation look at the order of entry a user would take. Enter a Purchase Order into the system and note the sequence of fields. Also don't forget any field that are system filled. This is the same sequence your dataport should take. All you are doing with a dataport is automating the process of a user entering the data.
RIS Plus, LLC
But I was actually mean to know about any tool or something of kind which gives the exact order of fields to be validated in a particular table. This is because when I am validating the fields according to the User entry in the related form, even then some of the fields are not getting validated (like for example, In the Purchase Header table, even though I am validating the Location Code, ShortcutDimensionCode1 fields etc its not getting validated but other fields like pay-from-vendor, posting Date etc fields are getting validated) but dataport running successfully and data is being inserted in to related table.My concern was on this :-k :-k
regards to U and all for incoming suggestions.
Falling down is not a defeat..defeat is when you refuse to get up.
I'm trying to attempt something similar...
I'm importing a list of vendors into the vendor table, and i've written a simple dataport to do this. However, I need to validate some fields in this process, such as Payment Terms & Vendor Posting Groups.
As per the Help function in NAV, Validate function tests the (1)Table Relation property of the field, and calls the (2)OnValidate trigger. Like DenSter mentioned in pervious post, field validation really doesn't work in dataports. My question is how do I do this in code? I'm not a NAV programmer, but given some guidance, I can try it out
thanks in advance!
Use these NEW variables as the SourceExpr in the View->Dataport Fields instead of the Nav-direct field.
This way all your data will be loaded into the variables.
Then on the OAfterImportRecord Trigger you can map the variables to their Navision counterparts in the order that you want & validate them too.
example/
Vendor.No := varVendNo;
Vendor.Name := varVendName;
Vendor.Address := varVendAddress;
etc. etc.
if you need to validate in there somewhere.
example/
Vendor."No." := varVendNo;
Vendor.Validate("No.");
Vendor.Name := varVendName;
Vendor.Address := varVendAddres;
etc. etc.
*Quick tip - look at the tables primary key. the fields listed there should all be validated
http://www.BiloBeauty.com
http://www.autismspeaks.org
Validation works for all fields except 'Name' in the Vendor table... :-k
Here is my code:
Name := VarName;
Vendor.VALIDATE(Name);
I want the above code to update the 'Search Name' field in the Vendor to 'Name'. However, all vendor records ends up with the same search name value, i.e. value from the first record imported.
e.g.
Name; Search Name
V1 ; V1
V2 ; V1
V3 ; V1
... etc.
For the time being, I've replaced the following code,
Name := VarName;
Vendor.VALIDATE(Name);
wiht this,
"Search Name" := VarName;
..for it to work.
Just wondering if this is the way to solve it... :?:
Thanks again!
http://www.BiloBeauty.com
http://www.autismspeaks.org