Question on dataport validation
 
            
                
                    jeffb_r4                
                
                    Member Posts: 34                
            
                        
            
                    Hi all.
I'm preparing a dataport to import sales order information from another system.
On the dataport import for the sales lines, I am validating the item no. (in the OnAfterImportRecord area) but when I do this, I lose the unit price information.
Can anyone advise on how I can validate the item number without losing the unit price information?
Thanks.
                I'm preparing a dataport to import sales order information from another system.
On the dataport import for the sales lines, I am validating the item no. (in the OnAfterImportRecord area) but when I do this, I lose the unit price information.
Can anyone advise on how I can validate the item number without losing the unit price information?
Thanks.
0                
            Comments
- 
            Hi
 If you bring the price into a variable and then assign the variable to the unit price after the validation of the item it should work, so as an example:
 VALIDATE (Type, Type::Item);
 VALIDATE ("No.",ItemVarable);
 VALIDATE (Quantity, QtyVariable);
 "Sales Line"."Unit Price":=PriceVariable;
 VALIDATE ("Sales Line"."Unit Price");
 "Sales Line"."Unit Cost (LCY)":=CostVariable;
 VALIDATE ("Sales Line"."Unit Cost (LCY)");
 I believe this worked for me.The art of teaching is clarity and the art of learning is to listen0
- 
            Validate it before you import the price. There are two possible approaches.
 1. Use the field validate property on the data port fields
 This requires that your data file list the fields in the order they need to be validated in.
 2. Import the price to a variable. Then assign it to the sales line after you validate the item no.There are no bugs - only undocumented features.0
- 
            Validate the "No." first then put in your price.
 Note you can either use the CallFieldCalidate Boolean in the Field Designer of the Dataport insteasd of putting it on the trigger.
 Or better yet - Import all your data into Variables then you can map them to it's proper matching NAV field in the order that you want.
 This way you have total control of what gets imported & when and you have more control of the validation process.
 ex./
 Lets say I have 3 variables i created in View->Golbals
 v_Imported_No
 v_Imported_Qty
 v_Imported_Price
 I enter these fields in the View->Dataport Fields instead of using the lookup directly to the Navision Standard Fields. Once the import begind the info is now saved in these variables. now on the OnAfterImportRecord I can bring them in the order that I want.
 "Sales Line"."No." := v_Imported_No;
 "Sales Line".VALIDATE("No."); //Get this out of the way!!!!!!
 "Sales Line".Quantity := v_Imported_Qty;
 "Sales Line".VALIDATE(Quantity); //Have control of validation
 "Sales Line"."Unit Price" := v_Imported_Price; //put in the price at end to avoid changing
 this is the proper way
 VALIDATE ("No.",ItemVarable);
 but i wanted to lay it out in an easy to understand manner 0 0
- 
            Looks like I typed in too much - before posting my answer - you guys are faster typists 
 Spent too much time on my pretty colors0
- 
            Excellent suggestions all.
 Thanks very much for the help!! I think I'll be using the variables approach. I find that the field validate property is kind of flaky, and doesn't always work. Has anybody else found that?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
- 323 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


