Questions tagged [number]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
34 views

Feed Me import from CSV ignores decimal point

I use Feed Me to import values from a .csv file into my entries. Since a day i have an issue i can't explain. I didn't change anything. Precisely, the issue concerns a number field. In the .csv file, ...
1
vote
1answer
20 views

Number field when empty and value=0

Is there a way to differentiate the number field value empty and 0? I would like to display this field only when there's a value in the field even though the value is 0. But when I input 0 into ...
3
votes
1answer
78 views

Math with numeric values derived from a dropdown field

I had a dropdown field with a handle of hLevel, with only numeric values in it, anticipating that I could do math with the values in my template. But it seems I can't. {% set dif = subhead.hLevel - ...
0
votes
1answer
30 views

Replace quotes in an array

I'm trying to use a charting library within a Craft template. The chart expects an array of numbers that I'm building up from a table but I'm getting an array of strings instead. {% set donutData = [...
1
vote
1answer
78 views

Non-numeric characters in number field producing errors

Craft 3 is giving me this error when my client enters non-numeric characters into a number field on an entry: number_format() expects parameter 1 to be float, string given Is there a way for it to ...
0
votes
2answers
239 views

Searching Number Field To See If It Falls In A Range

I'm building a property search form and searching by different types of fields in Craft. Here are my questions: How can I get a list of the unique cities in the entries section to declare my form ...
0
votes
1answer
69 views

Display children's order numbers

I thought this was going to be easy; showing the order number of children against their parent, but the only answer I can find is in this thread and I'm unsure how to implement this into my code. {%...
1
vote
2answers
115 views

Sum up number fields in the loop

I don't understand what's going on in my code logic because I'm getting unexpected output. I'd like to sum up three number fields in entries loop for the given post date range. Output gets almost ...
3
votes
1answer
126 views

Calculating a score based on a drop down field value

I am storing a value (number 1-5) in a drop down field and would like to do a calculation based on the numbers filled in. The only way I could get my calculation to work was to store the number (1-5) ...
1
vote
1answer
84 views

Unable to sort large number of blocks in Matrix field in CP and template

I have about 145 blocks in a single Matrix. If I try and re-arrange (drag&drop) the first few blocks, and then hit save, all is well. However, trying to re-arrange the last few blocks doesn't save ...
0
votes
1answer
201 views

Can I create a number with decimal point in number field?

Could number for example 7.5 be created in number field?
5
votes
4answers
2k views

Price Formatting

I'm outputting prices in a channel with a little formatting like so: £{{ entry.priceFrom|number_format(2,'.',',') }} Gives me £1,000.00 or £99.99 etc... However client isn't a fan of the ...
1
vote
2answers
363 views

How to check if number is prime?

How do I check if a given number is prime in twig?
12
votes
8answers
17k views

How would I omit zero value decimals in a number format?

Say I have {{ item.width }} and {{ item.height }} which are number fields with 2 decimal places. In my template I have this: <p>Dimensions: {{ item.width }} x {{ item.height }} in.</p> ...