The tag has no usage guidance.

learn more… | top users | synonyms

0
votes
1answer
29 views

Is there a modulus operator in AMPscript?

I'm looking for modulus operator in their docs but I can't find it so I though I would ask here. I have a loop written in AMPscript and I need to insert a piece of html every X item. Is there a ...
2
votes
0answers
14 views

Adding sales tax rules for many countries

I need to add sales tax rules for a whole host of countries (around 60) as my company is about to go global selling not just in the UK. The company works with external suppliers taxed in their own ...
0
votes
1answer
24 views

getting 3 random elements from a List

in our customer service system, when a customer phones up, the inquiries officer takes the customer through questions built out of fields populated on the customer record to check identity. Now I ...
6
votes
2answers
516 views

Possible bug in Math.round(decimal)

I have written this code and run anonymously, and got some strange results which seem to indicate a bug in Math.Round(decimal) - look like an overflow: Decimal d = 1000000000.0; Decimal dd = ...
1
vote
1answer
25 views

Remaining minutes in a day

I'm trying to get the remaining minutes of the current day, but the Datetime class its giving me headaches. (I'm going crazy) Datetime now = Datetime.now();//System.now(); System.debug(now); System....
9
votes
2answers
203 views

aura math expressions

I'm messing with Lightning Components doing some very angular-ish things. I like that we can use two-way binding with the "updateon" tag. Here's my code: <aura:component > <aura:...
4
votes
1answer
91 views

Can we do logarithmic axes on Visualforce charts?

I'm using Visualforce Charting to display stuff in a message queue by state. But faced with a display problem: there could be 1 guy in some state and 9999 guys in any other, eg: <apex:chart data="{...
6
votes
5answers
493 views

How to get the floor (round down instead of up) of a number with AMPscript?

I'm doing a bit of math with AMPscript, and I'd like to be able to round a number DOWN eg: I would like 5.5, 5.6, 5.7 etc.. to become 5, not 6 The standard FormatNumber() function will automatically ...
0
votes
2answers
38 views

How to divide Oppo RSF field on Oppo Products into equal amounts based on # of Oppo Products

In opportunity line item/product we have custom field called break up fee ...which will filled if the opportunity is closed lost. In oppy we have a roll up field will calculate the sum of all break ...
3
votes
1answer
123 views

Do we have RADIANS math function in Salesforce?

i am trying to find nearest stores and their longitude and latitude based on customer location (lon,lat) and populate in Google map. Here is a sample query would work in MySQL. Would this same query ...
0
votes
1answer
585 views

Ceiling Decimal in apex

I want to get the nearest ceiling for the decimal value. For 1268.0 => I want to get 1300. For 2537.0 => I want to get 2500. It would be like Excel function. I used value.round(roundingMode....
5
votes
2answers
3k views

What makes a field not groupable

I'm trying to use an aggregate query, but one of the fields I want to group by is not groupable (saw it in the soql error and then verified groupable=false in the metadata). It's just a number field ...
10
votes
2answers
1k views

Comparing floating-point values

In Apex, can Decimals be compared directly. For example: dec1 > dec2 or dec1 == dec2 In other languages I sometimes run into issues with fractions such that 1/3 and 0.33 are not going to be equal. ...
11
votes
1answer
777 views

Is there an average method for apex math

I was doing some bill calculations, and went looking in the math method for an average. Usage would be something like math.average(1, 4, 6, 7, 8, 9) math.average(ListOfIntegers) math.average(...
15
votes
1answer
18k views

Round a Decimal to two decimal places

How can I round an arbitrary Decimal to 2 decimal places (hundredths of a dollar)? My first thought was to use the Math Functions ROUND(number, numDigits): Decimal toRound = 3.14159265359; ...
17
votes
8answers
14k views

What is a concise function that formats a (String) decimal into a currency format in Apex?

goal: write the most concise function that formats a (String) decimal into a currency format in Apex. Feel free to trainwreck the code for points, I've kept mine exploded for readability purposes.