Printing Multiple Records with Related Functions

I’m trying to print multiple records using printtopdf, but if the form contains text display objects with related functions, it incorrectly prints the first record’s information for each selected record.

This only happens if the formula for the Text Display Object has a mix of local fields and related fields, like this envelope address example:

«City»+" "+«State»+" "+«ZIP»+¶+
«Country»},"Company Database")

If I remove the local field «Attn/Ship» from the formula and put it in another TDO by itself, then everything prints correctly. This workaround is not a big deal in this example, but I have more complex formulas were this workaround is not desirable. Adding an ignore("",field) at the end of the formula didn’t help.

I think that this was working correctly at some point, and tried it in b31,b32 and b33, getting the same results.

I have been able to duplicate this. In my test case putting the related( function in a separate TDO does not always work, it depends on the relative Z-order (back to front) of the objects. I can’t say for sure since I haven’t tracked down the exact problem code yet, but it seems unlikely to me that this ever worked correctly.

The superlookup() function also fails when printing multiple records, as reported for related().
It seems that lookup() is the way to go as a workaround, but I haven’t done enough testing.