Export from xml a list of values

Rikarddo
Member Posts: 80
Hi!
I have a xmlport that export data using this code:
But i have some problems
It only finds the first post code from table shipping address. How to run all the codes in the table and show them.
Second, if the customer has no shipping addresses then it will return the post code in the customer card ( not working)
How can i improve my code to get this working, or should i try this in other tag?
thanks for the help
I have a xmlport that export data using this code:
Ship-to Address - Export::OnPreXMLItem() CLEARALL(); ltBusRel.RESET; ltBusRel.SETRANGE("Contact No.",ContactoNo); ltBusRel.SETRANGE("Business Relation Code",'CLI'); IF ltBusRel.FINDFIRST THEN BEGIN ltcustomer.RESET; ltcustomer.SETRANGE("No.",ltBusRel."No."); IF ltcustomer.FIND('-') THEN BEGIN "Ship-to Address".RESET; "Ship-to Address".SETRANGE("Customer No.",ltcustomer."No."); IF "Ship-to Address".FINDSET THEN BEGIN REPEAT CodPostalEndEnv:="Ship-to Address"."Post Code";//+' - '+ltcustomer."Post Code"; pesquisacontacto.SETTABLEVIEW("Ship-to Address"); UNTIL "Ship-to Address".NEXT=0; END ELSE BEGIN CodPostalEndEnv:=''; CodPostalEndEnv:=ltcustomer."Post Code"; END; END; END;
But i have some problems
It only finds the first post code from table shipping address. How to run all the codes in the table and show them.
Second, if the customer has no shipping addresses then it will return the post code in the customer card ( not working)
How can i improve my code to get this working, or should i try this in other tag?
thanks for the help
0
Answers
-
Tried this
Put this Into OnPreXMLItem:CLEARALL(); CodPostalEndEnv:=''; ltBusRel.RESET; ltBusRel.SETRANGE("Contact No.",ContactoNo); ltBusRel.SETRANGE("Business Relation Code",'CLI'); IF ltBusRel.FINDFIRST THEN BEGIN ltcustomer.RESET; ltcustomer.SETRANGE("No.",ltBusRel."No."); IF ltcustomer.FIND('-') THEN BEGIN CodPostalEndEnv:=ltcustomer."Post Code"; "Ship-to Address".RESET; "Ship-to Address".SETRANGE("Customer No.",ltcustomer."No."); END; END;
And Put this into "Ship-to Address" OnAfterGetRecord:CodPostalEndEnv:="Ship-to Address"."Post Code";//+' - '+ltcustomer."Post Code"; pesquisacontacto.SETTABLEVIEW("Ship-to Address");
For a customer that has no shipping addresses , the value returns null. It should return the customer Post Code in this case.
For a customer that has shipping addresses it returns correctly the values from the table.
Then moved all code from OnPreXMLItem to OnPreXMLPort trigger but it returns all the addresses of the table independently of the customer...
Help?0 -
What's wrong with hungarian notation exactly?Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030 -
Really? Instead of helping, you criticize the way how code is inputed? Please save those criticisms for yourself0
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
- 322 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