Report Design
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Report Design
Message Icon Topic: Conditional Message Post Reply Post New Topic
Author Message
mvaughn
Newbie
Newbie
Avatar

Joined: 09 Oct 2007
Location: United States
Online Status: Offline
Posts: 16
Quote mvaughn Replybullet Topic: Conditional Message
    Posted: 29 Oct 2009 at 12:34pm
I have a report that is grouped by order number with a few fields in teh header and running totals for the report in the footer.  I do not show any detail records.  When building the table that feeds the report in VB I check field values for the parent/child tables.  If a parent item for an order is deleted the field is set to "I", if one of the children operations is deleted the field is set to "O" will also be setting the field to "F" if  item is ok to final.  Anyway on the report I need a message field to print if "I" or "O" and a 2nd message field to print if "F" I tried putting the values of the field I set into an array and print the message based on array value but I get a message in the footer of every order, not what I should have! I know this has something to do with the array not knowing it is order number dependant.. Any way I can set an array up so if has order number and when it prints the footer if order number is in the array with one the values I am looking for a message will print?
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 30 Oct 2009 at 6:33am
I am not quite sure what you are looking for. I suspect that the message is running off of the last line of you detail, as it is the current record in the detail when the footer is displayed. Either way, what I think will assist in your solution is to use a variable.
 
in the header you would set it to the default
in the detail you would set it to the condition that you want displayed in the footer.
then in the footer you can have a message that runs off the flag/variable that you have set.
 
does this work for you?  need more help?
IP IP Logged
mvaughn
Newbie
Newbie
Avatar

Joined: 09 Oct 2007
Location: United States
Online Status: Offline
Posts: 16
Quote mvaughn Replybullet Posted: 30 Oct 2009 at 6:48am
Not sure, I do not have a detail section. layout is kinda like this
GroupHeader
Order # Cust # Cust name
GroupFooter
Running totals for all the items that make up the page.  On this line is where I want to print a  message if an Item or Item Operation is deleted.
 
Right now I am building this array in the group header
whilereadingrecords;
Global stringvar array MsgArray;
numbervar Counter;
if not ({PL34ReportTable.Message}in MsgArray) then
(Counter := Counter +1;
if Counter < 1000 then
(Redim Preserve MsgArray[Counter];
MsgArray[Counter] := {PL34ReportTable.Message}))
and trying to do this in  the footer
 
whileprintingrecords;
Global stringvar array MsgArray;
if "I" in MsgArray  then
'WARNING - ITEM DELETED'
 Problem is I get the message on every line, should only have about 10  messages in the rpt.
 
I assume this is because the array is not matching the order to the group footer value since it is not in the array so can I build a 2 dimensiaonl array that has order # and all the messages for that order and then do soemthing like the message above. If so how?
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 30 Oct 2009 at 8:34am

there is a details section, you are just suppressing it.  You can place a formula in a suppressed section and it will still run. 

I don't use arrays much as I can't 'see' what is there.  When you think about it, the group header will only process the first record in the group, not all records.  In addition, since you are using Redim Preserve, the array is always the same, so if that message is EVER seen, it will be in ALL footers after first being seen....you never reset the array.
 
HTH
IP IP Logged
mvaughn
Newbie
Newbie
Avatar

Joined: 09 Oct 2007
Location: United States
Online Status: Offline
Posts: 16
Quote mvaughn Replybullet Posted: 30 Oct 2009 at 10:49am
Thanks for the input, I was trying to be lazy and not recode the VB but alas I have went back and spun through all the parents/children on the vb side and now have 1 record per order in the table that feeds the report.  The message field plugs correctly that way as well.
 
Thanks again
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.