Solved

Crystal formula result question

Posted on 2011-09-16
6
250 Views
Last Modified: 2012-08-13
This formula returns 75.00 everytime. The field HourlyRate defaults to 75.00. Then I check the location and employee type to determine if the hourly Rate should be chaned to 65.00 or 25.00.
What's the correct way to do this? I've been trying various things like instr but am not having luck. I need a formula that returns a number. If I remove the last line the formula returns true or false. Thanks.


Global NumberVar HourlyRate;
HourlyRate := 75.00;

If {Projects.Location} like "Apples" then
    HourlyRate := 25.00;


If {Projects.Employee Type} like "Oranges" then
      HourlyRate = 65.00;
 
HourlyRate;
0
Comment
Question by:MidWestGirl
  • 3
  • 2
6 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 36551375
Try this
WhilePrintingRecords;
Global NumberVar HourlyRate;
HourlyRate := 75.00;

If {Projects.Location} like "*Apples*" then
    HourlyRate := 25.00;


If {Projects.Employee Type} like "*Oranges*" then
      HourlyRate = 65.00;
 
HourlyRate;

mlmcc
0
 

Author Comment

by:MidWestGirl
ID: 36551407
H Mlmcc. The formula you suggested look like the one I tried. I'm not seeing the difference
between yours and the one I posted.
0
 

Author Comment

by:MidWestGirl
ID: 36551423
I did add the WhilePrintingRecords but it still comes out to 75.00 everytime.
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 100

Accepted Solution

by:
mlmcc earned 300 total points
ID: 36551686
I added * * around your text.  Like needs them to do a wildcard search.

mlmcc
0
 
LVL 34

Assisted Solution

by:James0628
James0628 earned 200 total points
ID: 36553875
mlmcc's right about the "*"s.  You need those for LIKE.  Another problem is this line near the end of your formula:

      HourlyRate = 65.00;


 That should be:

      HourlyRate := 65.00;


 := assigns a value to a variable.  = compares values.  It's an easy mistake to make, and to miss.

 So, if "Employee Type" contained Oranges, you were just comparing HourlyRate to 65, instead of setting it to 65.  That's why you got True or False when you removed the last line.  Actually, it should have always returned False.

 If you're still not getting the correct results after changing that, then there's something else going on.  Presumably "Apples" and "Oranges" are just example values.  If your real values are more complicated, maybe your tests aren't working.  Case might also be an issue (depending on your settings, "apples" may or may not match "*Apples*").  And if any of those fields could be null, that could be a problem.

 James
0
 

Author Closing Comment

by:MidWestGirl
ID: 36563182
Thanks! the 2 suggestions given to me worked.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now