- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2024 02:09 PM
I have a Flow that needs to do some conversion between MB and TB for updating a CMDB table (which is still using MB!) but I've run into an issue with the max value for an integer. However, I don't see an option to create a long integer data type for a flow variable. I do see an option for a float integer, does anyone know the top value for that data type?
Has anyone run into this and what did you do? I have to do calculations on the value so I can't keep it as a string.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2024 07:04 PM - edited 10-07-2024 08:46 PM
Hello @gjz
You may aware of that the ServiceNow is built on top of Java language, the limits are same.
int: 4 bytes, signed (two's complement). -2,147,483,648 to 2,147,483,647.
float: 4 bytes, IEEE 754. Covers a range from 1.40129846432481707e-45 to 3.40282346638528860e+38 (positive or negative).
In flow Designer you have one more type for variable that is Decimal and it's range is -999999999999999999999999999999999999.99,999999999999999999999999999999999999.99.
You should also consider your field data type in CMDB table, by default the field is of int type, and it's acceptable data range is same as Java int data type as mentioned above. If you need to store values higher than regualar int you should consider using long as field type, which has a range of -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807.
Even if you try to store a value larger than the allowed range in the field, the value will be truncated to its maximum allowed value. Either you use decimal type or float type flow variable, and field type of long, you need to restrict the value in fow variable to 8,796,093,022,207 (TB) so that in the record field you can have the maximum value of 9,223,372,036,854,775,807 (MB).
Please mark my answer helpful 👍 and accept as a solution ✔️ if it helped you.
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2024 07:04 PM - edited 10-07-2024 08:46 PM
Hello @gjz
You may aware of that the ServiceNow is built on top of Java language, the limits are same.
int: 4 bytes, signed (two's complement). -2,147,483,648 to 2,147,483,647.
float: 4 bytes, IEEE 754. Covers a range from 1.40129846432481707e-45 to 3.40282346638528860e+38 (positive or negative).
In flow Designer you have one more type for variable that is Decimal and it's range is -999999999999999999999999999999999999.99,999999999999999999999999999999999999.99.
You should also consider your field data type in CMDB table, by default the field is of int type, and it's acceptable data range is same as Java int data type as mentioned above. If you need to store values higher than regualar int you should consider using long as field type, which has a range of -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807.
Even if you try to store a value larger than the allowed range in the field, the value will be truncated to its maximum allowed value. Either you use decimal type or float type flow variable, and field type of long, you need to restrict the value in fow variable to 8,796,093,022,207 (TB) so that in the record field you can have the maximum value of 9,223,372,036,854,775,807 (MB).
Please mark my answer helpful 👍 and accept as a solution ✔️ if it helped you.
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2024 07:35 AM
Thanks AveshKumar, I should have thought to check Javascript's values. And it was good to mention the CI table - which uses decimal for the field. I'll change my flow variable to decimal.