Is it possible to format a number from a database but max it out at a specific number… I am using this in a calculation so wont display this information front end
I want the Max number to be 10!
example 1.
number in DB is 5 - calculated number is 5
example 2.
number in DB is 10 - calculated number is 10
example 3.
number in DB is 15 - calculated number is 10 (as 10 is the max!)
I know there is a truncate function for text but what would you recommend for integers?
Thanks for your help
How about just using a condition… when number is greater than 10, display text 10.
Hi,
this is in a workflow (sorry should have explained that). I am actually taking 3 values (with different max numbers) to calculate a total number.
I am trying to use <- min -> but I think the calculation is causing some issues…
result = value 1 <- min -> 2 * value 2 <- min -> 5 * value 3 <- min -> 10
I think the calculation is looking at take the value 1 or min value then using that in the second part (value2) and then the same for 3rd part. This means that it is mostly doing the valuation of value 2 or min * value 3 or min - giving me strange results.
Now I’m not totally clear on what you’re trying to accomplish. But if it’s simply that you want to limit the outcome to 10, then you can still apply the same logic in the workflow.
Step 1: Do your calculation.
Step 2: When result of step 1 >= 10, then change thing to 10.
sorry think I am over complimenting this and will go back to the design
I basically need to write one number to the database (say 15) but in a later workflow I read the 15 (from the DB) but set it to the max - lets say 10. I do this for 3 different values with different max numbers.
I need the actual number in the database (this would be 15 - as this is used elsewhere) but need to include a max in my calculation (10 in this case) otherwise I could get more than 100 in a calculation (a percentage).
Your explanation is something I will work with - cheers
1 Like
You and SerPounce certainly have it covered, but based on what you have described, I would have a second field in the data type, and I would write the number to both fields but change the number to 10 in the second field for any values greater than 10. Then, just use the second field to do your calculations and eliminate all the on the fly stuff.
Anyway, just food for thought on another way to go about it.
Best…
Mike
Hi Mike,
was thinking about this actually as a back up and thinking about it I think it would simplify the coding and I think reduce the processing needed. If I am unable to figure this out in the next hour this is my plan
Cheers,
Paul
1 Like