/
Kofax - Padding Zeros to an Index Field Value

Kofax - Padding Zeros to an Index Field Value

Applies to

Kofax Capture Version All

Summary

I want to have an Index Field that must have 5 numbers and not strip out leading zeros. How can this be done in a Validation script?

Answer/Solution

You can implement the IFormatProvider parameter of the ToString function as follows:

Private Sub Name0_FieldPostProcessing(sender As Object, e As PostFieldEventArgs) Handles Name0.FieldPostProcessing

Name0.IndexField.Value = CInt(Name0.IndexField.Value).ToString("D5")

End Sub

This only works with numerical input from the user so, you will need to check that an actual number was entered. Any other character will throw an exception.

CInt converts the input string to an Integer.

The "D5" passed to the ToString function tells it to format the integer to pad zeros at the left of the string to full length of five characters.

Related content

Kofax - Make an Index Field read-only in Validation
Kofax - Make an Index Field read-only in Validation
More like this
Kofax - Make an Index field read-only in Validation module using a SBL Field Macro
Kofax - Make an Index field read-only in Validation module using a SBL Field Macro
More like this
Kofax - Combo Box that accepts a Variant array in SBL Validation Script
Kofax - Combo Box that accepts a Variant array in SBL Validation Script
More like this
Kofax - Allow blank date fields using SBL Validation Script
Kofax - Allow blank date fields using SBL Validation Script
More like this
Kofax - Batch Field Validation
Kofax - Batch Field Validation
More like this
Kofax - Dynamically populate the suggested values drop down ComboBox for an Index Field using a VB.NET Validation Script
Kofax - Dynamically populate the suggested values drop down ComboBox for an Index Field using a VB.NET Validation Script
More like this

Copyright © CASO Document Management

All product names, logos, brands, and trademarks featured or referred to on this page are the property of their respective trademark holders. These trademark holders are not affiliated with, nor do they sponsor or endorse this website or the products/services offered unless explicitly stated otherwise.