I want to make a report with retail price. The retail price are in decimal values. Now i want to get the whole number as like:
For example
61.90 as 61
78.93 as 71
45.65 as 45
this format. anyone let u know. thanks in advance
You can use following functions to round down:
int(61.90) = 61
floor(61.90,1) = 61
Related
I have data as below:
241 97,5 143,5 17,5 21
203 90 113 8 23
I've loaded it to a hive table, and put data type as double but I've lost precision of data
For example 97,5 become 97,0
Perhaps it's a problem with the comma but I cant change my input file.
I've also tried to change the data type to string, it still the same but after I needed sum function it cast it to decimal I think so those values doesn't count at all.
I'm trying to sort a string field in crystal report that contains numbers and letters
I have:
21B
1
10
11B
33A
11
200
120C
11A
50
120A
1B
and I like to sort it like this: first numeric then letters
1
1B
10
11
11A
11B
21B
33A
50
120A
120C
200
I've tried
if length({Table.field}) = 1 then
"0" + {Table.field})
else if NumericText(right({Table.field}, 1)
then {Table.field}
else "0" + {Table.field}
but it doesn't give me the result I'm looking for
try like below
Create a formula #Sort and write below formula
val({Table.field})
Place the formula in section where you placed fields and supress it. Now sort the records with respect to the created formula.
In this hypothetical world, let's say that there is a school that offers classes A through Z. In order to graduate, you merely have to get so many hours in so many certain courses. This is recorded in this way (number = hours, letter = class):
Sunday 01/10/15 - 2A, 5H, 3Z
Monday 01/11/15 - 2A, 5Z, 5B
Wednesday 01/15/15 - 2A, 4Y, 6R
At the end of the individual record for the student, it would combine all numbers that had a matching letter, therefor showing the hour total in each class.
Sunday 01/15 - 2A, 5H, 3Z
Monday 02/15 - 2A, 5Z, 5B
Wednesday 01/15/15 - 2A, 4Y, 6R
6A, 5B, 5H, 6R, 4Y, 8Z.
While I am comfortable importing data and sorting data, I am having a hard time figuring out how to script it to add up all the numbers that share the same letter. If this data was hundreds of lines long and there was three instances of 2B in those lines, I would like it to be able to pick those out and show me 6B. What am I missing? Am I using the wrong tool for the job?
What you want is a dictionary of sums. In Powershell that would be a hash table of sums. Everytime you see a letter, look it up in your top level hash table and see if it is there. If not create a sum for that letter and add it to the hash table.
When you are done you can take the keys to the hash table and sort them, and then print out all the letter, sum pairs as key-value pairs.
I will write some code for that, but I need to have a coffee first :).
And here it is...
$slst = ("2A","5H","3Z","2A","5Z","5B","2A","4Y","6R")
$sums = #{}
foreach($s in $slst)
{
$skey = $s[1]
$sval = $s[0] - 48
$sums[$skey] += $sval
}
$sums.GetEnumerator() | Sort-Object Name
Note there was a longer version here before, but someone pointed out that you don't need to initialize dictionaries explicity in powershell.
I'm trying to do a little partitioning, dividing list entries into 6-month blocks. Using this LINQ to Entities query, I get results that imply that integer division is not taking place:
from e in enrollments
let AgeInHalfYears = e.AgeMonths / 6
select new { e.AgeMonths ,
AgeInHalfYears,
AgeFloor = ((int)AgeInHalfYears) * 6 }
My results are:
AgeMonths AgeInHalfYears AgeFloor
68 11 68
41 7 41
34 6 34
I would have expected 66, 36, and 30 in that last column.
I rewrote the LINQ pretty simply as
AgeFloor = e.AgeMonths - (e.AgeMonths % 6)
But I'm still curious about why the division operation is clearly floating point, even with that (int) cast in there... I wouldn't have expected that.
The Entity Framework is probably ignoring your cast when generating the SQL.
LINQ-based SQL generators are rarely (if ever) perfect.
In particular, .Net's type system is different enough from SQL's that they probably ignore all casts.
Try calling Math.Floor instead.
I'm using Zedgraph and I've a problem with values printed beside axis.
When my curve has values between 0 and 1000, no problem. But when I have values between 10 000 and 100 000 for example, Zedgraph prints 10 to 100 instead of 10 000 to 100 000 (or 1e4 to 1e5, I don't care).
Do you know which option can I change to have 10 000 to 100 000 instead of 10 to 100 ?
I've looked on scale.format property, it doesn't work.
One thing mode, when I use the contextmenu option "see values" the values printed near my cursor are good, so it's not a problem of wrong value saved by Zedgraph.
Thanks
Alex
yAxis.Scale.Mag = 0;
See Zedgraph-Documentation (API):
This (Mag) is used to limit the size of the displayed value labels. For example, if the value is really 2000000, then the graph will display 2000 with a 10^3 magnitude multiplier. This value can be determined automatically depending on the state of MagAuto. If this value is set manually by the user, then MagAuto will also be set to false.