Select to view content in your preferred language

format coomand in ArcGIS 10-VB

807
5
07-28-2011 11:25 PM
PoovalingaGanesh
Emerging Contributor
Hi,

I used "Format"command in Field Calculator in ArcGIS.9.x for formating Feild values.
Example: APN VALUES- 125
             APN VALUES- 12
I can format by using follwing structure
1) format([APN],"0000") = result will be "0125"
2) format([APN],"0000") = result will be "0012"

similaraly i  followed and calculated.
But in ArcGIS 10.0 not able to calculate. Please let me know how to use the "format" command.

thanks
Ganesh
0 Kudos
5 Replies
BartBoute
Deactivated User
Hi,

I used "Format"command in Field Calculator in ArcGIS.9.x for formating Feild values.
Example: APN VALUES- 125
             APN VALUES- 12
I can format by using follwing structure
1) format([APN],"0000") = result will be "0125"
2) format([APN],"0000") = result will be "0012"

similaraly i  followed and calculated.
But in ArcGIS 10.0 not able to calculate. Please let me know how to use the "format" command.

thanks
Ganesh


Hi Ganesh,

We have exactly the same problem here. A good working VB-function in ArcGIS 9.3.1 can't be used in ArcGIS 10, because the FORMAT function isn't supported anymore in AG10's field calculator.

Please let me know if someone solved the problem.

Thanks,

Bart Boute
BELGIUM
0 Kudos
IABG_mbHIABG_mbH
Emerging Contributor
Hello ESRI,

I have the same problem. Is there a solution in the meantime?


Thanks,

Jörg
0 Kudos
BartBoute
Deactivated User
Hello,

After a long search I found out that the answer is ZFILL in Python. Open the Field Calculator and choose parser: Python (and not VB Script)

Example 1
TERRID: OSK01
SZONE: A1
BPNR: 1
RESULT: OSK01A1001

Example 2
TERRID: OSK01
SZONE: X
BPNR: 1
RESULT: OSK01X0001

Calculation (Python)
!TERRID! + (!SZONE! .ljust( 2, '0' )) + (str(!BPNR!).zfill(3))

Can ESRI please give us a list of functions simular to FORMAT, that don't exist anymore in ArcGIS10, with the according function in Python?

Greetings :cool:,
Bart from Belgium
0 Kudos
IABG_mbHIABG_mbH
Emerging Contributor
Bart from Belgium, thank you very much!

The solution works beautifuly.



Jörg
0 Kudos
ratnakartini
New Contributor
Hi,

I used "Format"command in Field Calculator in ArcGIS.9.x for formating Feild values.
Example: APN VALUES- 125
             APN VALUES- 12
I can format by using follwing structure
1) format([APN],"0000") = result will be "0125"
2) format([APN],"0000") = result will be "0012"

similaraly i  followed and calculated.
But in ArcGIS 10.0 not able to calculate. Please let me know how to use the "format" command.

thanks
Ganesh


Mr Ganesh i have the answer, hope it can help u and others outside...

Example:

BP_TEXT: 1

RESULT: 001

Calculation (Python)
!BP_TEXT! .rjust(3,'0')

Have a nice day....

Ratna, Putrajaya.
0 Kudos