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;
Answers
Put this Into OnPreXMLItem:
And Put this into "Ship-to Address" OnAfterGetRecord:
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?
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03