Object Data: 'character' to 'integer', value is truncated

Object Data: 'character' to 'integer', value is truncated

iamthedlo
Explorer Explorer
606 Views
4 Replies
Message 1 of 5

Object Data: 'character' to 'integer', value is truncated

iamthedlo
Explorer
Explorer

We currently have hundreds of files worked on by different people, and unfortunately overtime, there are files where object data was inputted under 'character', and some under 'integer'.

 

I'm trying to convert everything back to 'integer', but when i do that, the object data is actually trimmed off at the end when i switch the OD from 'character' to 'integer'.  so e.g., if the value of the OD is 12345 (under character), when i change the OD to 'integer', I get a warning saying 'error 851973: object data is truncated', and the value now is 1234 as oppose to 12345.

 

This happened to every object, under the same object data table, in the same drawing.  Please help, thanks!

0 Likes
607 Views
4 Replies
Replies (4)
Message 2 of 5

Pointdump
Consultant
Consultant

Hi @iamthedlo,
Sounds like you have a mess.
Screen shots please of how you are switching from character to integer. You might also post a small sample drawing with the problem.
Dave

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2025
0 Likes
Message 3 of 5

O_Eckmann
Mentor
Mentor

Hi @iamthedlo ,

 

I can reproduce this behaviour (even in Map 2025). It seems to truncate and keep only the 4 first characters.

I've tried to convert from Character to real, but same problem.

 

If you want to try my free plugin. There is a function "ODOut" to export selected fields to TXT file, then you can convert type of field, and use function ODIN to re import data from TXT file.

But it must be done in each drawing, I haven't planning this function to work in command line without dialog.

 

Olivier Eckmann

EESignature

Message 4 of 5

iamthedlo
Explorer
Explorer

Thanks for temp. solution.

 

In my case, all 5-digit value turns to 4, 6 into 5, 3 into 2...etc.

Is what's happening a bug, or would this eventually be fixed?

0 Likes
Message 5 of 5

ChicagoLooper
Mentor
Mentor

@iamthedlo 

You can do it using the existing Map3D toolset. No special add-ons or code is needed.

 

Assuming you have already used MAPIMPORT to add your points/linework AND have added those points/linework WITH OBJECT DATA, then you can do it.

 

1. Go to Map Setup tab=>Attribute Data Panel=>Define Object data Icon=>Click Table dropdown arrow=>Select your Object Data Table from the dropdown=>Modify button

Image-1Image-1

 

 

Then, to change the 'data type' from a Character to a Number with decimals,  do this:

2. Select the FIELD (attribute) you want to convert=>Click arrow dropdown for TYPE=>select 'Real'=>Update=>OK=>CLOSE to EXIT. 

Image-2Image-2

 

The field will become a real number with decimals, but it does NOT preserve the number of decimal places in the original string (character), it will truncate the significant digits, but you already know that. At this stage, you have the option to export to the linework to shapefile format. 

 

You might say the solution is to develop a workflow to change character to a real number while maintaining the right number of decimals, but that wouldn't be correct because that just downplays that the attribute was mistakenly entered as a character string rather than a real number. The KEY is to know 'HOW TO'  input real numbers with decimals in the first place!

 

Chicagolooper

EESignature

0 Likes