Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Crytal if formula

Posted on 2013-01-02
7
Medium Priority
?
309 Views
Last Modified: 2013-02-13
I need help with a formula that show true if the price ends with a 0 or 5 and False if not.

Thanks!!!!
0
Comment
Question by:evend
7 Comments
 

Accepted Solution

by:
FLProfessional earned 668 total points
ID: 38738726
it's a little dirty, but this should work:


local stringvar checkprice:=ToText(table.price, 2);

If { MID(checkprice,len(checkprice),1) = "0" or MID(checkprice,len(checkprice),1) = "5"} Then
   //put whatever you want here, it's true
Else
   // it's false
End If
0
 
LVL 101

Assisted Solution

by:mlmcc
mlmcc earned 668 total points
ID: 38738910
Does price have decimals?  If so the formula above should work but it would be easier with RIGHT instead of MID

local stringvar checkprice:=ToText(table.price, 2);

If { Right(checkprice,1) = "0" or MID(checkprice,1) = "5"} Then
   //put whatever you want here, it's true
Else
   // it's false
End If

Open in new window


If prices are in dollars (no cents then)

local stringvar checkprice:=ToText(table.price, 0);

If { Right(checkprice,1) = "0" or MID(checkprice,1) = "5"} Then
   //put whatever you want here, it's true
Else
   // it's false
End If

Open in new window


mlmcc
0
 
LVL 35

Assisted Solution

by:James0628
James0628 earned 664 total points
ID: 38739304
Converting the price to a string, as in the posts above, is the most flexible solution.  Then you can check for any digits you want.

 But since you're specifically looking for 0 and 5, Mod is another option.

 If your field is an integer:

({price field} Mod 5) = 0


 If your field has 2 decimal places and you want to check the last decimal place:

(({price field} * 100) Mod 5) = 0


 James
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:evend
ID: 38883125
I've requested that this question be deleted for the following reason:

A friend helped me with.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 38872251
What was your solution, you have 3 very plausible comments.

Did you try any of them?

If so what was the result?

mlmcc
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 38883126
You need to address the comments from the experts before deleting this question.

The comments provided are viable solutions which should be accepted as such

mlmcc
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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 …
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

886 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