Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 310
  • Last Modified:

Crytal if formula

I need help with a formula that show true if the price ends with a 0 or 5 and False if not.

Thanks!!!!
0
evend
Asked:
evend
3 Solutions
 
FLProfessionalCommented:
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
 
mlmccCommented:
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
 
James0628Commented:
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
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
evendAuthor Commented:
I've requested that this question be deleted for the following reason:

A friend helped me with.
0
 
mlmccCommented:
What was your solution, you have 3 very plausible comments.

Did you try any of them?

If so what was the result?

mlmcc
0
 
mlmccCommented:
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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now