Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Urgent!Crystal Reports X Error: "a print time formula that modifies va 1

Status
Not open for further replies.

carlkc

IS-IT--Management
Mar 10, 2006
5
HK
Dear all,

I have written a formula in CR 10 and used in a cross-tab, but when I preview the report, I have received the following error msg:
"A print time formula that modifies variables is used in a chart or map Details: @detail"

the code of "detail" in that summarized field in cross-tab is like that:

shared stringVar compComment;
{@Grade_ATA2} +
(
if isnull({tb_asr_rptpSCORE.ChComment_ATA2}) or len({tb_asr_rptpSCORE.ChComment_ATA2}) = 0 then
(if isnull({TB_ASR_RptPScore.CHSUBJCOMNAME}) then compComment := '';
if (not isnull({TB_ASR_RptPScore.CHSUBJCOMNAME})) and ((trim({TB_ASR_RptPScore.CHSUBJCOMNAME}) = 'Chinese') or (trim({TB_ASR_RptPScore.CHSUBJCOMNAME}) = 'English')) then compComment
else
'')
else
if ({TB_ASR_RptPScore.CHSUBJNAME} = 'Chinese') or ({TB_ASR_RptPScore.CHSUBJNAME} = 'English') then
((if isnull({tb_asr_rptpSCORE.ChComment_ATA2}) or len({tb_asr_rptpSCORE.ChComment_ATA2}) = 0 then
compComment := ''
else
compComment := '*');
'')
else (
compComment := '';

'*')
)
_________________________________________
My CR report links to 3 tables:TB_ASR_RPTCONDUCT, TB_ASR_RPTPSTUDENT and TB_ASR_RPTPSCORE.As the data comes from a complex database system, I'd rather provide you the form for reference instead of type out the table structure so that u can have a more clear picture abt that.

Pls download the report from this site:

And the problematic formula "subjcomp"which stated in the previous msg is in charge of giving "*" next to the marks

Thus, in the summerized field "detail" in cross-tab, that field will consists of the above 2 formulas, i.e. (@Grade_ATA2}+(@subjcomp}

Those "*" originally displayed in the main subject. However,I'd like to move those * to subject components (e.g. Reading) as the followings:


(Remarks: only two Main Subjects have "subject components, i.e. Chinese has 2 subject components:Reading and Writing; English has 2 also: Reading and Writing)and the expected result should be like that:


For the subjects without subject components like Maths, Music..etc will NOT be affected.
 
Your links don't seem to work. Why are you declaring the variable as shared? This forces a later evaluation time. You might want to elminate the "shared" or rewrite the formula without using a variable.

-LB
 
Dear lbass,
Thanks for your assistance!I have updated the links as follows for your reference. But I dont understanding how to rewrite the formula without using a variable, pls kindly give me a hand, my deadline is coming...[sadeyes]
The report:

Orginial results generated by the report:

Expected results by using the formula above:(beware the difference of those "*")

Again, thx for your kindly assistance!

KC
 
What happened when you removed "shared"? Did the report still error out?

I don't follow the parts of your formula in bold:

if {@#SETTING_ATA2_DROPEXEMPTIND} <> ' ' then
{@#SETTING_ATA2_DROPEXEMPTIND}
else
if {@#SETTING_ATA2_PASSIND} = 'Y' then

trim(left({TB_ASR_RPTPSCORE.ENGRADE_ATA2}, 2)) + (
if isnull({tb_asr_rptpSCORE.ChComment_ATA2}) or len({tb_asr_rptpSCORE.ChComment_ATA2}) = 0 then
(if isnull({TB_ASR_RptPScore.CHSUBJCOMNAME}) then compComment := '';
if (not isnull({TB_ASR_RptPScore.CHSUBJCOMNAME})) and ((trim({TB_ASR_RptPScore.CHSUBJCOMNAME}) = 'Reading') or (trim({TB_ASR_RptPScore.CHSUBJCOMNAME}) = 'Reading')) then compComment //what value do you expect compComment to take on here?
else
'')
else
if ({TB_ASR_RptPScore.CHSUBJNAME} = 'Chinese') or ({TB_ASR_RptPScore.CHSUBJNAME} = 'English') then
((if isnull({tb_asr_rptpSCORE.ChComment_ATA2}) or len({tb_asr_rptpSCORE.ChComment_ATA2}) = 0 then
compComment := ''
else
compComment := '*');
'') //what is this supposed to do?
else (
compComment := '';

'*')//and this?
)
else
trim(left({TB_ASR_RPTPSCORE.ENGRADE_ATA2}, 2))

-LB
 
Dear Lbass,

Thanks for your help, I have tried to move "shared" but cannot produce the expected results.

if {@#SETTING_ATA2_DROPEXEMPTIND} <> ' ' then
{@#SETTING_ATA2_DROPEXEMPTIND}
else
if {@#SETTING_ATA2_PASSIND} = 'Y' then

trim(left({TB_ASR_RPTPSCORE.ENGRADE_ATA2}, 2)) + (
if isnull({tb_asr_rptpSCORE.ChComment_ATA2}) or len({tb_asr_rptpSCORE.ChComment_ATA2}) = 0 then
(if isnull({TB_ASR_RptPScore.CHSUBJCOMNAME}) then compComment := '';
if (not isnull({TB_ASR_RptPScore.CHSUBJCOMNAME})) and ((trim({TB_ASR_RptPScore.CHSUBJCOMNAME}) = 'Reading') or (trim({TB_ASR_RptPScore.CHSUBJCOMNAME}) = 'Reading')) then compComment//what value do you expect compComment to take on here?
the "compComment" is used to move the Main subjects which with "*" to related subject components.
else
'')
else
if ({TB_ASR_RptPScore.CHSUBJNAME} = 'Chinese') or ({TB_ASR_RptPScore.CHSUBJNAME} = 'English') then
((if isnull({tb_asr_rptpSCORE.ChComment_ATA2}) or len({tb_asr_rptpSCORE.ChComment_ATA2}) = 0 then
compComment := ''
else
compComment := '*');
'') //what is this supposed to do?
the '*' is inputed from a "ChComment_ATA2" field and will be printed next to Main Subjects, however, I wanna move those marked "*" to related subject components. You can have a look of the before and after results.
else (
compComment := '';

'*')//and this?
)
else
trim(left({TB_ASR_RPTPSCORE.ENGRADE_ATA2}, 2))
 
Dear Lbass,
In addition, I found that with the same formula, after I have removed the "shared", some of the "*" in the expected result will be missing, is it the formula bugs or the problem of the cross-tab?
Again, thanks for your kindly assistance!

Leon
 
Your last post didn't really answer my questions, and I still don't know why you used "shared" in the first place--are values coming from or to a subreport?

Did someone else write this formula? My first question in my last post relates to the fact that compComment has not been assigned a value in the formula other than "". In other words, it would always result in "" at that point unless it retained a value from a previous record (which might be creating the problem for the crosstab). The last two questions are simply because I don't follow, and your explanation didn't really help me--so I'm not sure I can really help. Maybe someone else can.

-LB
 
Dear LB,

Sorry to trouble you as I haven't clearly answer your question.

>I still don't know why you used "shared" in the first >place--are values coming from or to a subreport?

Yes, I used "shared" as I have another report which links to a subreport. Thus, inside this subreport, I have used "shared"

>My first question in my last post relates to the fact >that compComment has not been assigned a value in the >formula other than "". In other words, it would always >result in "" at that point unless it retained a value >from a previous record.

I'm not sure whether my logic is correct or not, the value "*" which is originated inputted in a seperated database field {tb_asr_rptpSCORE.ChComment_ATA2}.As I wanna to move the values stored in {tb_asr_rptpSCORE.ChComment_ATA2} from Main Subjects to subject components, thus I used compComment as a "temporary storage", am I logically correct?

>The last two questions are simply because I don't follow, >and your explanation didn't really help me--so I'm not >sure I can really help. Maybe someone else can.


((if isnull({tb_asr_rptpSCORE.ChComment_ATA2}) or len({tb_asr_rptpSCORE.ChComment_ATA2}) = 0 then
compComment := ''
else
compComment := '*');
'') //what is this supposed to do?
the '*' is inputed from a "ChComment_ATA2" field and will be printed next to Main Subjects, however, I wanna move those marked "*" to related subject components. And '' is used when there's nothing inputted in ({tb_asr_rptpSCORE.ChComment_ATA2})

else (
compComment := '';

'*')//and this?
It is used the keep the "*" for other subjects to show normally.
)

I hope I can express it clearly as I was already get mad with those code in these few days.
BTW, thx for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top