Identifying Whole Numbers Vs Integers (1 Viewer)

trw5027

New member
Local time
Today, 03:23
Joined
May 3, 2013
Messages
2
I currently have a calculated field that will result in either a whole number or a decimal. From there, I need to set up a field that identifies if the previous field is either a whole number or a decimal.

I have tried several different formulas, but always seem to get an error or a query that does not return any results.

Edit: Title of post should be Whole Numbers Vs. Decimals or Integers Vs. Decimals

Any help?

Thanks,

Tim
 
Last edited:

plog

Banishment Pending
Local time
Today, 05:23
Joined
May 11, 2011
Messages
11,665
I was with you until this:

the previous field

What's the previous field? Is that the field in the prior record? Is it the field in the column to the left of the field you are referencing? Post some sample data along with field names and then what you expect the results to be.
 

trw5027

New member
Local time
Today, 03:23
Joined
May 3, 2013
Messages
2
Sorry- Should have been more clear with my fields.
The below is the calculated field in my query which I am looking to identify as either an integer or decimal.


Layers: [Past 90 Days April]![INTORG]/[Item Master]![Layer]

In a subsequent field, I am looking to have the numbers from the Layers field identified as either an integer or decimal.

Example:

If layer=3, Integer
If layer= 3.2, Decimal
 

plog

Banishment Pending
Local time
Today, 05:23
Joined
May 11, 2011
Messages
11,665
You can't reference the calculated 'Layers' in the same query you calculate it. That means you either use the query you have now as a sub-query to another where you can reference Layers, or you have to use the underlying calculation that produces it in your determination of if its a decimal or integer.

Save the query you have now and then create a new one using that query as its source. Then add this calculated field to it:

NumberType: IIf([Layers]-CInt([Layers])=0,"Integer","Decimal")

It works by subtracting the integer part of Layers from the actual value of Layers. If the actual value is an integer then the calculation will equal 0.

If you wanted to add NumberType to your current query (the one where Layers is calculated) you would use my above formula but replacing instances of '[Layers]' with its underlying calculation ('[Past 90 Days April]![INTORG]/[Item Master]![Layer]').
 

Users who are viewing this thread

Top Bottom