Regarding field validation through dataports
gdkve9
Member Posts: 161
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..
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.
Falling down is not a defeat..defeat is when you refuse to get up.
0
Comments
-
If you are using the CallFieldValidate then the order of your dataport fields is important. Since this will determine the order in which they are validated.
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.There are no bugs - only undocumented features.0 -
I've found the field validation in dataports to be severely inadequate to say the least. Rather than trusting the properties, I would import all field values into variables and then program the validation myself.0
-
Thanq Mr.BBrown..
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.Dilip
Falling down is not a defeat..defeat is when you refuse to get up.0 -
Hi All,
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!0 -
Create Variable for every field you are importing.
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 validated0 -
Thanks alot...

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!0 -
just to be safe
Name := VarName; "Search Name" := UPPERCASE(VarName);
0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
