Nagornyi,
I having another problem with this. I have done what you suggested in the above post but am have a problem within these letters. It seems to me that the text in the paragraphs is off. For example some of these letters only have 4 paragraphs and different text, but after I run the report the letter after it is what has the 4 paragraphs with the text that should be on the previous letter. The query for the report is pulling the data correctly so I don't know where to look.
Here is what I'm doing inside my formula column:
if (instr

PARA2,'We ask that you bring all current medications with you in their proper containers') > 0) then

_para2_text_before:=substr

PARA2,1,instr

PARA2,'We ask that you bring all current medications with you in their proper containers') - 1);

_para2_text:=substr

PARA2,instr

PARA2,'We ask that you bring all current medications with you in their proper containers'),length('We ask that you bring all current medications with you in their proper containers'));

_para2_text_after:=substr

PARA2,length('We ask that you bring all current medications with you in their proper containers') + instr

PARA2,'We ask that you bring all current medications with you in their proper containers'), length

PARA2) - (length('We ask that you bring all current medications with you in their proper containers') + instr

PARA2,'We ask that you bring all current medications with you in their proper containers')));

_para3_text_before:=

ARA3;

_para3_text:='';

_para3_text_after:='';

_para4_text_before:=

ARA4;

_para4_text:='';

_para4_text_after:='';

_para5_text:=

ARA5;

_para6_text:=

ARA6;

_para7_text:=

ARA7;
elsif (instr

PARA3,'We ask that you bring all current medications with you in their proper containers') > 0) then

_para3_text_before:=substr

PARA3,1,instr

PARA3,'We ask that you bring all current medications with you in their proper containers') - 1);

_para3_text:=substr

PARA3,instr

PARA3,'We ask that you bring all current medications with you in their proper containers'),length('We ask that you bring all current medications with you in their proper containers'));

_para3_text_after:=substr

PARA3,length('We ask that you bring all current medications with you in their proper containers') + instr

PARA3,'We ask that you bring all current medications with you in their proper containers'), length

PARA3) - (length('We ask that you bring all current medications with you in their proper containers') + instr

PARA3,'We ask that you bring all current medications with you in their proper containers')));

_para2_text_before:=

ARA2;

_para2_text:='';

_para2_text_after:='';

_para4_text_before:=

ARA4;

_para4_text:='';

_para4_text_after:='';

_para5_text:=

ARA5;

_para6_text:=

ARA6;

_para7_text:=

ARA7;
elsif (instr

PARA4,'We ask that you bring all current medications with you in their proper containers') > 0) then

_para4_text_before:=substr

PARA4,1,instr

PARA4,'We ask that you bring all current medications with you in their proper containers') - 1);

_para4_text:=substr

PARA4,instr

PARA4,'We ask that you bring all current medications with you in their proper containers'),length('We ask that you bring all current medications with you in their proper containers'));

_para4_text_after:=substr

PARA4,length('We ask that you bring all current medications with you in their proper containers') + instr

PARA4,'We ask that you bring all current medications with you in their proper containers'), length

PARA4) - (length('We ask that you bring all current medications with you in their proper containers') + instr

PARA4,'We ask that you bring all current medications with you in their proper containers')));

_para2_text_before:=

ARA2;

_para2_text:='';

_para2_text_after:='';

_para3_text_before:=

ARA3;

_para3_text:='';

_para3_text_after:='';

_para5_text:=

ARA5;

_para6_text:=

ARA6;

_para7_text:=

ARA7;
else

_para2_text_before:=

ARA2;

_para2_text:='';

_para2_text_after:='';

_para3_text_before:=

ARA3;

_para3_text:='';

_para3_text_after:='';

_para4_text_before:=

ARA4;

_para4_text:='';

_para4_text_after:='';

_para5_text:=

ARA5;

_para6_text:=

ARA6;

_para7_text:=

ARA7;
end if;
return('XXX');
Let me know what you think. I'm kind of at a loss here.
Thanks,
Chris.