You need to sign in to do that
Don't have an account?
Ted Chapman
Print Anything - Duplication of Merge Field Names
Greetings,
I am working on a Print Anything package to display shipping rate quotations. Each Quote (Opportunity) has multiple Freight Charges (custom object, child of Opportunity), and each Freight Charge has an Origin and a Destination. Origin and Destination are both joins to a custom Location object.
Here's the problem, I have a SOQL query in the package of the following structure:
select Origin__c, Origin__r.Name, Destination__c, Destination__r.Name, Minimum__c, Remarks__c, Units__c, Per_Unit__c, CurrencyIsoCode from Freight_Charge__c Where Opportunity__c = [opportunity id]
The query works correctly and pulls the right data, but Print Anything assigns both Origin__r.Name and Destination__r.Name to the same Merge Field value of Freight_Charge__c4.Location__c.Name.n. In the debug output of Print Anything, I can see the 2 correct Location names, but I cannot access them individually in order to print correctly.
i'd say break up your SOQL query into two seperate queries, one to get Origin_r.Name and then another to get Destination__r.Name, like:
select Origin__c, Origin__r.Name, Minimum__c, Remarks__c, Units__c, Per_Unit__c, CurrencyIsoCode from Freight_Charge__c Where Opportunity__c = [opportunity id]
and then another sequence (5)
select Destination__c, Destination__r.Name, Minimum__c, Remarks__c, Units__c, Per_Unit__c, CurrencyIsoCode from Freight_Charge__c Where Opportunity__c = [opportunity id]
these would then show up as
Freight_Charge__c4.Location__c.Name.n
and
Freight_Charge__c5.Location__c.Name.n
right?
Interesting thought, any idea whether or not the rows would come out in the same order? That is, would Freight_Charge__c4.Location__c.Name.n and Freight_Charge__c5.Location__c.Name.n both refer to the same record for the same value of n?
Will try to see if it works, but I'm a little afraid it will work on test case but not be structurally sound for all cases...
Thanks for the response!!!
order by createddate
should work, then both queries will have the same rows in the same order