Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: conditional x and y position field Post Reply Post New Topic
<< Prev Page  of 3 Next >>
Author Message
Paul46
Newbie
Newbie


Joined: 19 Feb 2008
Online Status: Offline
Posts: 22
Quote Paul46 Replybullet Posted: 11 May 2009 at 6:10am
Sorry for being away this long, but we had other priorities at work.

Well actually there is no sum necessary in the report. We don't have to sum up anything. There are for example ordered 6 muffins, we book this in the program (Full House) and the amount of 6 gets generated onto the report.

So i think this should make things even simpler.
As far as i can see this means i have to make heads with text labels and footers with the amount field. But then the question pops up: how to bind an certain amount field to a certain text field?
But i think you answered this already with the following:

For your running totals conditinaly sum the amount field based on the Item description. You will have to create one per item.
Example Running Total #1 (lunch)
Field to summarize=Amount Field
Type=SUM
Evaluate as a formula:  table.item="Lunch"


So, as being a newbie, how should i set this up when there are no running totals or sums necessary?

For instance i don't get your last line "Evaluate as a formula: table.item="Lunch"

I mean, is a text label also a table.item? If i only could bind the field: amount to a certain text label then i would be so much further.

Then i think i can make it work by setting it up like:

Coffee (in header - text label)
6 (in footer - field: amount)

Tea (in header -  text label)
25 (in footer - field: amount) etc.

But as i said the field: amount gets directly generated from Full House so this field can have any amount in it.

So, in the formula of the field: amount  how do i say the following in crystal reports language for let's say item Coffee:

When this field is bigger then zero determine by which booked horeca item this number belongs (the fields with the actually booked horeca-items are also in my report but surpressed. I use the text labels instead in order to get all possible items on my report and not only the actually booked items) and put it in the footer thats beneath the header with text label Coffee.

I am aware that i write this as a four year old (lol) but i hope someone still follows this.

Thanks.
Eriic
< id="WebWizRTE" ="RTE_.asp?mode=reply&ID=651" style="border: 1px solid rgb(165, 172, 178);" onload="initialiseWebWizRTE();" width="490" height="100">
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 11 May 2009 at 7:24am
Your header footer idea is fine if your data output is one column per food type and 1 row with the totals:
Coffee    Tea       Muffin     
   4           6            5
However it will not work well if it is like i think it is with a column of food type and totals and one row per item:
coffee    4
Tea        6
Muffin     5
 
If I am incorrect please let me know as this assumption is the premise for my answer.
When you place an item on the report it is going to evauate it for 1 row, it does not really look at all of the rows and then choose the appropriate item. There are ways to mimic that but I think the simplest solution is for you to use Running totals. I understand it is redundant because you already have the total, however this process essentially makes it possible for you to get a result that evaulates all of the records and then give you back the one record you are looking for, like coffee, and place it so you can consistently join it to a text field with the word "coffee" in it.
When creating a running total you can tell it to only sum the items where another related field is a particluar thing (like "coffee").
So my example of "Evaluate as a formula: table.item="Lunch" is referring to making the running total check all of your data and only return back a sum (which in your case is going to be redundant of yur already summed data) of all of your rows where your data also="Lunch"
Follw this example to seee what I mean.
Right click on Running totla and select NEW.
In the Running total Name call it "Lunch"
In Field to Summarize select your database field that has your totals in it
in Type of Summary select SUM
in the Evaluate section click on the toggle next to Use a Formula
Click on the X-2 button - a window should open
this is where you put in the formula to tell it when to sum so it is going to be something like
{table.descriptionfield}= "Lunch"
You will have to replace the {table.descriptionfield} with your actual table name and field from your database. Make it = to the exact output that lets you know that that row is your LUNCH item. It may be the word Lunch as in my example or it may be a code like L1 or something else.
Save and close the formula window (making sure you do not get an error)
In the Reset section leave it toggled to Never ( this assumes you do not have multiple groupings in your report for a new menu display for multiple clients. IF that is true this can still work we just need to reset it differently)
Click OK
You now have a RT field called "Lunch" in your list of available DB items in your Field Explorer.
Drag and drop this on the Group or Report footer (Running total do not work in headers).
Preview the report.
You should see the field with only the total of # of lunches. you can drag that all around the footer and it won't chaneg the number. YOu can ad a text field net to it that states "Lunch".
If you repeat this for each of the items you now can always join the correct label with the correct item and place them in any order you want on the footer.
Does this make sense?
 
IP IP Logged
Paul46
Newbie
Newbie


Joined: 19 Feb 2008
Online Status: Offline
Posts: 22
Quote Paul46 Replybullet Posted: 12 May 2009 at 1:06am
Okay, thank you very much for still helping me. I will study and try to work out your advise step by step. It will take me a while, not in the last place because i need to do this inbetween my daily tasks and i don't have CR or Full House at home, but i will come back with the results and i will get this working.
Thank you very much for your continuing support sir.

Greetings Eric
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 12 May 2009 at 6:17am
Since I don't use running totals...just not that familar with them, my suggestions was formulas with shared variables, but the effect would be the same.  for the formulas to work, you would have 1 formula in the detail section that would update shared variables for the different items that you are watching, then in the group footer, you would have 1 formula for each item you are watching to return its value.
 
The effect is the same, because the data is the same, it is just the method, and ultimately, that is pretty much the same.  I think that I use shared variables because I need to give totals for several levels, and it is a programatic style of running total.
IP IP Logged
Paul46
Newbie
Newbie


Joined: 19 Feb 2008
Online Status: Offline
Posts: 22
Quote Paul46 Replybullet Posted: 28 May 2009 at 2:40am
@DBlank. Thank you very much again. Your solution works perfectly.
@Lockwell. I'm sure you gave sound advise too, but i am just a newbie and not familiar with shared variables, but thank you anyway.

Now i have one more problem to solve and then i can release this report.
I tried to solve this problem on my own, but i cannot figure it out for the live of me. So i hope you guys can help me with this too.

In our program Full House is a textfield. The textfield is intended for comments. So for instance when someone orders lunch for their group and they want it served in the room, we can put this comment in the textfield, like: "wants it served in the room".
Now i put this textfield at the bottom of the report in a footer.
This textfields in Full House belong (or are together, i hope i expressed this right) to the items we book in Full House, in this case horeca items. So if we book a lunch there is a textfield in the item lunch we can fill with comments.
Now the problem is that in the report only the comment (textfield) of the last booked item appears, the item with the highest number in Full House.

I hope i was clear enough and i hope you can help me get this right.

Thanks again
Eric

IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 28 May 2009 at 6:10am
alas, if the comment desired is not the last one, and you want it in the report footer, the only way that I know is....shared variables.
 
I use them a lot because they are so versatile, and always operate the same.
 
you will need 3 formulas with for the shared variables 1) set the comments to blank, 2) display the comments, 3) add to the comments.  actually as I reread the need, you don't need an initializer (set to blank) as the comments are going in the report footer.
 
they're really easy to use. this one goes in the group header
shared stringvar comments := ""  //you can skip this one
 
to add to the comments--place in the detail section of the report
shared stringvar comments := comments + trim({table.commentField});
""  //this will hide the ever growing string
 
finally to display the results (place in the report footer)
shared stringvar comments
 
that's it, not too hard at all.
 
HTH
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 28 May 2009 at 8:16am

To clarify here, Lockwelle's process is going to add all of your comments togther into one long string that can be placed in the footer but it is not identifying it as a commnet specific to any one food item.

My guess is you still need to place each comment next to each food item.
IF this is tha case you can adjust the variable process to account for it but surprisingly Running Totals should also work for your needs.
If I am correct here you will need to create one RT per item again.
 
Here is a sample for the lunch comment process.
Right click on Running total and select NEW.
In the Running total Name call it "Lunch Comment"
In Field to Summarize select your Comments field
in Type of Summary select Maximum
in the Evaluate section click on Use a Formula
Use the same formula you used to count lunches, somthing like {table.descriptionfield}= "Lunch"
Click OK
 Place this new RT field to display Luch Comments wherever you want in your footer.
If it works fine (it should) repeat per food type you need to add coments for.
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 28 May 2009 at 11:08am

DBlank is right, mine will return a big string.  For some reason I thought that this was going to be in the REPORT footer, not a GROUP footer.  For a group footer, I would reset the variable to "" in the group header (one more formula)

If you are happy with Running Totals, follow DBlank's advice.
IP IP Logged
Paul46
Newbie
Newbie


Joined: 19 Feb 2008
Online Status: Offline
Posts: 22
Quote Paul46 Replybullet Posted: 11 Jun 2009 at 8:29am
Hi,
The comment section works perfectly well now, thanks again for your good advice.
Although i wrote earlier that the items section with the running total solution works perfectly well, but this is not the case after a good live testing in the organisation. I thought i was ready to release this report, but not.

The problem is as follows:

Running total name: Coffee, Lunch etc. every separate horeca - item we have got.
Field to summarize: Megaview.Comp_Quantity (Comp stands for Component, i did not make this field name up, the maker of Full House did)
Type of Summary: Sum


Evaluate section:

Use a formula: {MEGAVIEW.COMP_DESCRIPTION}= "Lunch"



Reset section:

When i tried your suggestion of leaving this toggled at Never, what happens is... two things:
1) In every next page of the report it sums the total. So if i have Lunch - 2 on the first page of the report, it says offcourse Lunch 2, that is good, but on the second page (this is the next booking, i have one booking per page) if i have Lunch 3 it gets summed up with the first page so i get Lunch 5 on that second page.
2) If i have Lunch - 3 in the first booking, so on the first page, and in the second booking i have no lunch at all, i get on the second page Lunch - 3 (so this amount must come from the first page / booking).

So this is no good. So i decided to try 3 of the four options in the reset section:

1) toggle Never - as described above

2) toggle By change of field (or some name like that, i have the Dutch CR version so i don't know the exact english name for this toggle) - this option comes very very close to what i want. If i choose the field MEGAVIEW.COMP_QUANTITY here everything is good except the first page where a certain item is booked.

So for example:
i book 3 lunch on the first page / booking,
i book no lunch on the second page / booking
i book 10 lunch on the thirth page / booking.

What i get is:
No lunch on the first page!!! - wrong
no lunch on the second page - good
10 lunch on the thirth page - good


3) Toggle By change of group - i did not try this because the four groups that i can choose from here have almost certainly nothing to do with the footer i have al my horeca items in.

4) Use formula - I tried this formula {MEGAVIEW.COMP_DESCRIPTION}= "Lunch", the same as in the evaluate section.
What happens here is:
i book no lunch in the first page / booking.
i book 3 lunch in the second page / booking.
i book 5 lunch in the thirth page / booking
i book no lunch in the fourht page / booking

What i get is:
No lunch on the first page - good
3 lunch on the second page - good
5 lunch on the thirth page - good
5 lunch on the fourth page - wrong.

So it repeats the amount of the second last page on the last page.

Well i hope you guys still follow this thread. I am almost there thanks to you, but i only have to get those amounts good.

I hope you still have any ideas how to solve this.

Thanks Eric



Edited by Paul46 - 11 Jun 2009 at 8:41am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Jun 2009 at 7:06am

Hi Eric,

I was wondering when this problem would pop up. I have not re-read the entire thread so I hope I remember this well enough to ...
If you do not already have a group set up you will need to add in a group on the Customer Field.
This will give you a group footer.
Change all of your Running Totals to Reset on "Change of group" (probably group1 which is CUstomer level).
expand teh group footer to be large enough to fit all of report footer items on it.
Move all the Report footer items ont the group footer.
You proabably want to set a new page after the group footer also but by creating a grouping on the customer, resting the RT on that group and moving teh fields to that footer you should get the correct #'s for each customer (per food item).
IP IP Logged
<< Prev Page  of 3 Next >>
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.031 seconds.