Thursday, October 23, 2008

Use despeckle blocks to indicate where people should write each character. "A Guide to Creating Machine-Readable Forms" recommends raster dots .39 pixels, and five times that space between each dot.

Thursday, October 23, 2008 12:05:32 PM (Mountain Standard Time, UTC-07:00)  #    Comments [0]  | 
Wednesday, October 22, 2008

Many useful libraries are included in the standard VBScript and JScript languages. There are libraries for regular expressions, string manipulation, math, and much more.

There are also libraries for connecting to databases. And while there is a FC8 Database Check rule, often you will want to customize its behavior. You can do that by connecting to the database with vbscript and adjusting the logic as you need. Here is an example of connecting to a Microsoft Access Database and populating the result to a suggestion box.

FC8:
Dim conn
Dim rs
Dim strSQLQuery
Dim arrayRows

Wednesday, October 22, 2008 12:04:13 PM (Mountain Standard Time, UTC-07:00)  #    Comments [0]  | 
Tuesday, September 02, 2008

var ItemsCount = Field(“Total”).Items.Count;
var Sum = 0;
Field(“TotalAmount”).Value = Field(“TotalAmount”).Value.replace(” “,”“);
for( i = 0; i     Field(“Total”).Items.Item(i).Value = Field(“Total”).Items.Item(i).Value.replace(” “,”“);
    Sum = Sum + parseFloat(Field(“Total”).Items.Item(i).Value);
}
if (Sum != parseFloat(Field(“TotalAmount”).Value)) {
    CheckSucceeded = false;
    ErrorMessage = “Sum of values in Total column doesn’t match TotalAmount value”;  
    Field(“TotalAmount”).Suggest( Sum );
}
else {
    CheckSucceeded = true;
}

Tuesday, September 02, 2008 8:45:37 AM (Mountain Standard Time, UTC-07:00)  #    Comments [0]  | 
Monday, June 23, 2008

Rect r;
If Not kwInvoiceNumber1.IsNull Then {
r = kwInvoiceNumber1.Rect;
r.Inflate(10*dt,10*dt);
restrictsearcharea(r);
}
Else If Not kwInvoiceNumber2.IsNull Then {
r = kwInvoiceNumber2.Rect;
r.Inflate(10*dt,10*dt);
restrictsearcharea(r);
}
Else DontFind;

Monday, June 23, 2008 7:21:52 PM (Mountain Standard Time, UTC-07:00)  #    Comments [0]  | 
Friday, June 13, 2008

Zero Padding a Field to 10 characters- VB Script

dim cnt
dim iter
dim tempString
cnt = Len(me.Field("StoreNumber").Value)
tempString = me.Field("StoreNumber").Value
For iter = 0 to 10-cnt
tempString = "0" + tempString
Next

Adding Dashes to a Social Security Number - VB Script

Dim TempSSN
TempSSN = Mid( Me.Field("SSN").Value, 1, 3 )
TempSSN = TempSSN & "-"
TempSSN = TempSSN & Mid( Me.Field("SSN").Value, 4, 2 )
TempSSN = TempSSN & "-"
TempSSN = TempSSN & Mid( Me.Field("SSN").Value, 6, 4 )
Me.Field("SSN").Value = TempSSN

Concatenating Values from a column of a table into a single field - JScript

var ItemsCount = Field("TotalColumn").Items.Count;
var Sum = 0;
var tempField = "";
for( i = 0; i < ItemsCount; i++ ){
tempField = tempField + "," + Field("TotalColumn").Items.Item(i).Value;
}
Field("CombineField").Value = tempField;

Friday, June 13, 2008 4:27:46 PM (Mountain Standard Time, UTC-07:00)  #    Comments [0]  | 
Thursday, June 12, 2008

Finding addresses is hard if the address is unlabeled.

Use this regular expression in a character string to help find addresses. Add post-search code that favors addresses near the top of the page ( FuzzyQuality: Top, {0,0,200,25000 }*dt; ), and/or near some address label ( FuzzyQuality: AddressLabel.Left - Left, {0,0,200,15000 }*dt; ), and you'll be acquiring addresses like you're Donald Trump.

[0-9]{1-6}*{1-30}(
([Dd]*{0-10}[Ee])|([Dd][Rr])
|([Ss]*{0-7}[Tt])
|([Aa]*{0-7}[Ee])|([Aa][Vv])
|([Cc]*{0-7}[Tt])
|([Bb]*{0-10}[Dd])
|([Ll]*{0-3}[Ee]))*{0-30}

Thursday, June 12, 2008 4:32:36 PM (Mountain Standard Time, UTC-07:00)  #    Comments [0]  | 
Monday, June 09, 2008

Compare number ranges in ABBYY FlexiCapture

 

vbscript

 

dim val, val1

val = me.Field("Field1").Value

val1 = CInt(val)

 

if val1 >= 1.00 and val1 <= 32.47 then

                me.Field("Field2").Value = "text"

else if val1 >= 32.48 and val1 <= 58.63 then

                me.Field("Field2").Value = "text"

else if val1 >= 58.64 and val1 <= 70.19 then

                me.Field("Field2").Value = "text"

else if val1 >= 70.20 and val1<= 77.71 then

                me.Field("Field2").Value = "text"

else if val1 >= 77.72 and val1 <= 100 then

                me.Field("Field2").Value = "text"

end if

Monday, June 09, 2008 8:33:55 AM (Mountain Standard Time, UTC-07:00)  #    Comments [0]  | 
Wednesday, March 26, 2008

Restrict search area to a sliver next to a label:

          rightof:label;

          above:label.bottom,-20*dot;

          below:label.top,-20*dot;

 

Only grab a capture element if the label element is found:

          if label.isnull then dontfind;

 

Select the capture element closest to a label element:

          nearest:label;

 

Select the label element closest to the top of the page:

          nearesty:pagerect.top;

 

Select the label element closest to the bottom of the page

          nearesty:pagerect.bottom;

 

Limit the search area to the top half of the page:

          above:pagerect.bottom/2;

 

Limit the search area to the upper right hand quadrant of the page:

          above:pagerect.bottom/2;

          rightof:pagerect.right/2;

 

Choose between two capture areas, combine the results in a third:

          if not firstchoice.isnull then

          restrictsearcharea(firstchoice.rect);

          else if not secondchoice.isnull then

          restrictsearcharea(secondchoice.rect);

          end if

 

Choose between n capture areas:

          if not firstchoice.isnull then

          restrictsearcharea(firstchoice.rect);

          else if not secondchoice.isnull then

          restrictsearcharea(secondchoice.rect);

          else if not thirdchoice.isnull then

          restrictsearcharea(thirdchoice.rect);

          .

          .

          .        

          else if not lastchoice.isnull then

          restrictsearcharea(lastchoice.rect);

          else dontfind;

          end if

 

Expand table borders:

          exactcolumnborders(labelfield.left,-30*dot,labelfield.right,-30*dot,block.tablename.columnname);

Wednesday, March 26, 2008 1:30:52 PM (Mountain Standard Time, UTC-07:00)  #    Comments [0]  | 
Thursday, February 14, 2008

vbscript

 

If me.Field("field1").Value = “text”

Thursday, February 14, 2008 9:38:41 AM (Mountain Standard Time, UTC-07:00)  #    Comments [0]  | 
Monday, January 21, 2008

Here are two rules that you should find useful. Remember if you are modifying a field, make sure it is not marked “Read-Only”! More rules to come:

 

Date Normalization in VBScript
On Error Resume Next
me.FIELD(“InvoiceDate”).Value = FormatDateTime(me.FIELD(“InvoiceDate”).Value, vbGeneralDate )
If Err.Number 0 Then
    me.ERRORMESSAGE = “Error, Date is in Invalid Format”
    me.CHECKSUCCEEDED = False
End If

 

Type Conversion, Numerical Compare in VBScript
Dim AIValue, temp
On Error Resume Next
temp = me.Field(“AnnualIncome”).VALUE
If Err.Number 0 Then
    me.ERRORMESSAGE = “Error, Income is in Invalid Format”
    me.CHECKSUCCEEDED = False
End If
AIValue = temp + 0
if AIValue > 1500 then
    me.CheckSucceeded = true
else
    me.ErrorMessage = “Warning! Low annual income”
    me.CheckSucceeded = false
    me.FOCUSEDFIELD = me.FIELD(“AnnualIncome”)
end if

Monday, January 21, 2008 2:35:23 PM (Mountain Standard Time, UTC-07:00)  #    Comments [0]  | 

Pick a theme: