×
Menu
Index

9.1.5. ChronoDocument

 
The ChronoDocument object is the document being processed or edited: its fields, pages, OCR text, grids, bookmarks, document type, AI requests and the Enterprise workflow (approve, reject...).
It is available in document and field events and in the scripts of the customizable buttons. Any other document of the batch can be obtained with ChronoBatch.GetDocument(index) or ChronoBatch.getSelectedDocument. In the OnDocumentSplit event a second object, ChronoSplittedDocument, is the new document created by the split (same methods).
 
Methods
Returns
Method
Description
short
AddPage
(string file, short pos = -1)
Adds a new page from a file
Parameters
file (string): Path to file
Returns: 1 = True, 0 = False
Example
ChronoDocument.AddPage(file)
short
AddXgridRow
(short GridPanel)
Adds a new row on the grid
Parameters
GridPanel (short)
Allowed values: 1, 2, 3, 4
Returns: 1 = True, 0 = False
Example
' Add row to grid 1
Dim val
val = ChronoDocument.AddXgridRow(1)
short
AI_DeleteResponse
(string configname = "")
Deletes the AI response saved in the document for the given AI configuration (OpenAI alias, Gemini configuration or Ollama prompt; empty = all), so the next ExecuteProcess sends the request again instead of reusing the saved one. Returns the number of files deleted.
short
Approve
()
Since v1.0.2.96
Approves a document (approval workflow). *Only for jobs with approval workflow active, otherwise it will return 0
Returns: 1 = True, 0 = False
ChronoScan Enterprise only.
Example
res = ChronoDocument.Approve()
short
BanApprover
(string userid)
Approval workflow (Enterprise): prevents a user from approving this document.
string
ConvertStringToDate
(string date)
Converts a date string written in the capture date format of the station into the output date format.
short
ConvModulePdfEditGenerate
(string ConvModuleName, string InputFile, string OutputFile)
Fills a template PDF using the configuration of a pdfEdit conversion module of the job. Document variables are resolved against this document.
short
CopyXgridRows
(short GridPanel, object srcDoc)
Copies the rows of a grid panel from another document (srcDoc) into this document.
short
CreateNewDocumentType
(string TypeName)
Creates and forces a document type
Parameters
TypeName (string): Document type name, null if default name
Returns: 1 = True, 0 = False
Example
res = ChronoDocument.CreateNewDocumentType("NEW DOCUMENT TYPE NAME")
short
DeletePage
(short page)
Deletes a specific page
Parameters
page (short): Page number (0 based)
Returns: 1 = True, 0 = False
Example
Dim res
res = ChronoDocument.DeletePage(0)
short
DeleteXgridRow
(short GridPanel, short row)
Deletes a row of a grid panel.
Parameters
GridPanel (short)
Allowed values: 1, 2, 3, 4
row (short): Table row number (0 based)
Returns: 1 = True, 0 = False
Example
Dim r
r = ChronoDocument.DeleteXgridRow(1, 0)
void
EnableFieldValidation
(string fieldName, short newVal)
Enables (1) or disables (0) the validation of a field for this document.
short
EntAddToEventLog
(string description)
Since v1.0.2.95
It Adds a record to the event log in an enterprise app.
Parameters
description (string): The description to log
ChronoScan Enterprise only.
Example
ChronoDocument.EntAddToEventLog("description here")
short
EstimateRequestTokens
(string configname)
Estimates the number of tokens that the AI configuration (configname) would send for this document.
short
ExecuteConversionModule
(string confname)
Execute a conversion module and its child conversion/output modules. The module will execute even if it is not active
Parameters
confname (string): Configured conversion module name
Returns: 1 = True, 0 = False
Example
Call ChronoDocument.ExecuteConversionModule(module_name)
short
ExecuteProcess
(string operations)
Runs a processing chain on this document only (same syntax as ChronoBatch.ExecuteProcess, for example "OCR;TYPEDETECT;FIELDREAD"). Returns 1 on success.
short
Extract_ZHSwissTax_Xml
()
Extracts the embedded XML of a Swiss ZH tax PDF as an attached file; use get_opt_attachment("xml") to get its path.
string
FullOCR
(string engine, string flags)
Rebuild document OCR using an specific engine
Parameters
engine (string)
Allowed values: ChronoScan OCR, Nuance, gocr *(Google Vision), Tesseract
flags (string): Reserved
Returns: A string describing the result
Example
ChronoDocument.FullOCR ("gocr", "")
string
FullOCRPage
(string engine, short page, string flags)
Runs a full-page OCR of one page (1-based) with the given engine (empty = active engine; ChronoScan OCR, Tesseract, Nuance...). flags: 1 = rebuild (discard the previous OCR). Returns the OCR text.
string
GeminiRequest
(string modelname, string systemprompt, string userprompt, short includedoc = 0)
Sends a request to a Google Gemini model and returns the answer. includedoc=1 appends the document text to the user prompt. Empty on error: see GetLastAIError.
string
GeminiRequestPage
(string modelname, string systemprompt, string userprompt, short page)
Sends ONE page of the document (page 1-based) to a Gemini model: with a _vision model the page image is sent, otherwise its OCR text. Returns the model answer (empty on error: see GetLastAIError)
variant
GeminiRequestPages
(string modelname, string systemprompt, string userprompt, string pages, short maxthreads = 0)
Sends SEVERAL pages of the document to a Gemini model IN PARALLEL, one request per page, up to maxthreads at a time (0 = 4, max 8). pages: 1-based, comma separated, ranges allowed ("3,7,12-15"). Returns an array with one answer per page in the same order (answers(0) = first page of the list); an empty answer means that page failed: see GetLastAIError(page)
string
get_doc_dir
()
Returns the folder of the document inside the batch.
string
get_doc_hash
()
Returns a hash for the document based on all page hashes
Returns: Document hash
Example
Dim hash
hash = ChronoDocument.get_doc_hash
string
get_doc_page_file
(long index)
Returns the image file of a page of the document (page 1-based).
string
get_doc_page_hash
(long index)
Returns a hash for the specified page
Parameters
index (long): Page index (1 based)
Returns: Page hash
Example
Dim hash
hash = ChronoDocument.get_doc_page_hash(1)
string
get_doctype_param
(string param, string defval)
Reads a document type custom value
Parameters
param (string): Name of the item to get
defval (string) optional: Default value if not set
Example
taxes = Document.get_doctype_param("CALCTAXES", "false")
string
get_masterkey_param
(string param, string defval)
Reads a master key custom value
Parameters
param (string): Name of the item to set
defval (string) optional: Default value if not set
Returns: Master key custom value
Example
currency = ChronoDocument.get_masterkey_param("CURRENCY", "USD")
string
get_opt_attachment
(string exten)
Returns the path of a file attached to the document with the given extension (for example xml or xlsx), empty if there is none.
short
get_page_count
()
Returns the number of pages of the document
Returns: Number of pages
Example
Dim val
val = ChronoDocument.get_page_count()
long
GetDocFirstSelectedPage
()
Return the first page of a selection
Returns: First selected page index (starts at 0)
Example
SelectedPage = ChronoDocument.GetDocFirstSelectedPage + 1
long
GetDocNumber
()
Returns the current document number
Returns: Current document number
Example
Dim val
val = ChronoDocument.GetDocNumber()
object
GetDocumentType
()
Returns the DocumentType object of the document (see the DocType topic).
string
GetEntStatus
()
Since v1.0.2.96
Returns the enterprise document status
Returns: unknown, increation, created, pre_class, reprocess, processed, post_class, configured, corrected, approved, exported, export_error_status, archived, parked, processing_error, waiting_approval, rejected, ready_to_export, waiting_external_actions
ChronoScan Enterprise only.
Example
res = ChronoDocument.GetEntStatus()
object
GetField
(string FieldName)
Returns the UserField object of a field of the document. Use the field name as it appears in the Data entry form.
Parameters
FieldName (string): Field name
Returns: UserField: object (https://chronoscan.org/doc/userfield.htm)
Example
Set field = ChronoDocument.GetField(field)
short
GetFieldCount
()
Returns the number of fields in a document
object
GetFieldIdx
(short idx)
Return UserField object of a specific field
Parameters:
short field idx (starting by 0)
string
GetFieldValue
(string fieldName)
Returns the value of a field of the document. Use the field name as it appears in the Data entry form. (Replaces the old get_field_value.)
string
GetFullOcr
(short page = -1, short mode = 0)
Returns the full ocr text for a whole document or a single page
Parameters
page (short): Page number (0 based), -1 for all pages
mode (short)
Allowed values: 0 = unformatted, 1 = formatted
Returns: OCR Text
Example
Dim ocr
ocr = ChronoDocument.GetFullOcr(-1, 1)
variant
GetIntellitagCandidates
(string fieldName, short bestlabel = 0)
Returns a two dimensional array with all the candidates for the selected intellitag list and the related information
Parameters
fieldName (string): Insert the name of the field that is linked to the desired intelli-tag list.
bestlabel (short) optional
Allowed values: 0 = Is the default value, 1 = Ignores duplicates by selecting only the highest scoring results
Returns: 0. Intelli-tag search string, the string being searched for, 1. Intelli-tag label search result, the string found on the document, 2. Intelli-tag function search result, the result of the search function or static value, 3. Page number, the page number where the intelli-tag was found, 4. Score, the score for the current intelli-tag, 5. Boolean, highest score. If 1 the current intelli-tag is the highest score, 6. User value 1, 7. User value 2, 8. User value 3
Example: see example 1 at the end of this page.
string
GetLastAIError
(short page = 0)
Returns the error of the last GPTRequest / GeminiRequest / GPTRequestPage(s) / GeminiRequestPage(s) call of this document (empty if it went fine). With a page number (1-based) returns the error of that page in the last GPTRequestPages / GeminiRequestPages call.
string
GetPageFieldValue
(short page, string FieldName)
Returns the value of a page field (page 1-based), for example SrcFile. (Replaces the old get_page_field_value.)
short
GetValidateStatus
()
Returns the validation status
Returns: 0 = Error, 1 = Validated
Example
dim status
status = ChronoDocument.GetValidateStatus()
string
GetVariableValue
(string varname)
Returns a ChronoScan variable, it includes variables related with the document
Parameters
varname (string): Requested variable to ChronoScan, for example "station_id"
You can see a complete variable list in the variables wizard window of ChronoScan.
Returns: value for the selected ChronoScan variable.
Example
Dim val
val = ChronoDocument.GetVariableValue("station_id")
short
GetXgridColumnCount
(short GridPanel)
Returns the number of columns of a grid panel (1-4).
string
GetXgridColumnValue
(short GridPanel, short row, short col)
Returns the value of a specific capture grid field by column number
Parameters
GridPanel (short)
Allowed values: 1, 2, 3, 4
row (short): Table row number (0 based)
col (short): Field name
Returns: Value of specified grid, row and column
Example
'Get the value of the first row, first column from grid 1
Dim r
r = ChronoDocument.GetXgridColumnValue(1, 0, 0)
short
GetXgridFieldBitmap
(short GridPanel, short row, string fieldName, string bmpFile)
Saves the zone bitmap of a specific capture grid field to a file
Parameters
GridPanel (short)
Allowed values: 1, 2, 3, 4
row (short): Table row number (0 based)
fieldName (string): Field name
bmpFile (string): Path to destination file
Returns: 1 = True, 0 = False
Example
'Get the value of the first row, first column from grid 1
Dim r
r = ChronoDocument.GetXgridFieldBitmap(1, 0, fieldName, destinationFile)
string
GetXgridFieldValue
(short GridPanel, short row, string FieldName)
Returns the value of a specific capture grid field
Parameters
GridPanel (short)
Allowed values: 1, 2, 3, 4
row (short): Table row number (0 based)
FieldName (string): Field name
Returns: Value of a specific capture grid field
Example
Dim val
val = ChronoDocument.GetXgridFieldValue(1, rowNumber, fieldName)
short
GetXgridRowCount
(short GridPanel)
Returns the number of records of a specific capture grid
Parameters
GridPanel (short)
Allowed values: 1, 2, 3, 4
Returns: Row count
variant
GetXGridSelectedRows
(short GridPanel)
Returns an array containing the selected rows in an specific XGrid
Parameters
GridPanel (short)
Allowed values: 1, 2, 3, 4
Returns: Rows array
Example
GridPanel=1 'first panel
RowsArray = ChronoDocument.GetXGridSelectedRows(GridPanel)
For i = 0 To UBound(RowsArray)
    MsgBox "Row: "&RowsArray(i)&" is selected"
Next
short
GetZoneFieldBitmap
(string fieldname, string bmpFile)
Saves the zone bitmap of a specific field to a file
Parameters
fieldname (string): Field name
bmpFile (string): Destination file
Returns: 1 = True, 0 = Error
Example
Dim res
res = ChronoDocument.GetZoneFieldBitmap(fieldName, destinationFile)
short
GetZoneFieldJpg
(string fieldname, string jpgFile)
Saves the zone jpg of a specific field to a file
Parameters
fieldname (string): Field name
jpgFile (string): Destination file
Returns: 1 = True, 0 = Error
Example
Dim res
res = ChronoDocument.GetZoneFieldJpg(fieldName, destinationFile)
string
GPTRequest
(string modelname, string systemprompt, string userprompt, short includedoc = 0)
Since v1.0.3.7
Function to make an openAI request to a specified model with system prompt and user prompt
Parameters
modelname (string): Model to make the request
Allowed values: *any chatgpt available model
systemprompt (string): System prompt for the request
userprompt (string): User prompt for the request
Returns: OpenAI response
Example
Dim response;
response = ChronoDocument.GPTRequest("gpt-3.5-turbo", "You are an accountant that helps users. Your response will be just one line.", "Give me company name normalized and without acronyms")
string
GPTRequestPage
(string modelname, string systemprompt, string userprompt, short page)
Sends ONE page of the document (page 1-based) to an OpenAI model: with a _vision model the page image is sent, otherwise its OCR text. Returns the model answer (empty on error: see GetLastAIError)
variant
GPTRequestPages
(string modelname, string systemprompt, string userprompt, string pages, short maxthreads = 0)
Sends SEVERAL pages of the document to an OpenAI model IN PARALLEL, one request per page, up to maxthreads at a time (0 = 4, max 8). pages: 1-based, comma separated, ranges allowed ("3,7,12-15"). Returns an array with one answer per page in the same order (answers(0) = first page of the list); an empty answer means that page failed: see GetLastAIError(page)
short
Ignore
(short mode = -1)
Ignores/ unignores the document
Parameters
mode (short)
Allowed values: 0: Set as not ingored, 1: Ignore
Returns: 1 = True, 0 = False
Example
Dim val
val = ChronoDocument.Ignore(1)
short
IgnorePage
(short page, short mode = -1)
Sets as ignored not ignored a desired page
Parameters
page (short): The page number (1 based index)
mode (short)
Allowed values: 0: Set as not ingored, 1: Ignore
Returns: 1 = True, 0 = False
Example
' Ignore page 1
Dim val
val = ChronoDocument.IgnorePage(1, 1)
short
InsertXgridRow
(short GridPanel, short Pos)
Inserts a row in a grid panel (1-4) at position Pos. Returns the index of the new row.
short
IsIgnored
()
Tells us if the document is ignored
Returns: 1 = True, 0 = False
Example
Dim val
val = ChronoDocument.IsIgnored()
short
IsPageIgnored
(short page)
Tells us if a specific page is ignored
Parameters
page (short): The page number (1 based index)
Returns: 1 = True, 0 = False
Example
Dim val
val = ChronoDocument.IsPageIgnored(1)
short
LookupForceValidation
(string LookupName)
Runs the validation of a lookup of the document again (empty name validates all the lookups).
Parameters
LookupName (string) optional: (empty validates all lookups)
Returns: 1 = True, 0 = Error
Example
Call ChronoDocument.LookupForceValidation(lookupName)
short
LookupSetValidateStatus
(string LookupName, short newStatus)
Sets the validation status of a lookup of the document (LookupName = lookup configuration name).
short
MoveDocument
(short pos)
Moves the document to a position
Parameters
pos (short): New position
Returns: 1 = True, 0 = False
ChronoScan Enterprise only.
Example
 res = ChronoDocument.MoveDocument(newposition)
short
MovePage
(short page, short position)
Moves a page to a specified position
Parameters
page (short): Page index (1 based)
position (short): New position
Returns: 1 = True, 0 = False
ChronoScan Enterprise only.
Example
Dim res
res = ChronoDocument.MovePage(1, ChronoDocument.get_page_count)
msgbox res
short
MovePageTo
(object DocTo, short page, short position)
Moves a page (1-based) of this document to another document (DocTo) at the given position. Returns 1 on success.
short
PageAddBookmark
(short page, string bookmarkName, string color)
Adds a page bookmark (page 1-based) with a name and a color (for example "#FF0000").
short
PageHasBookmark
(short page, string bookmarkName)
Returns 1 if the page has the given bookmark.
short
PageRemoveBookmark
(short page, string bookmarkName)
Removes a page bookmark by name.
short
ReadOCRZone
(string fieldname)
Reads again the OCR zone of a field of the document. The return value is reserved.
short
Reject
(string reason = "")
Since v1.0.2.96
Rejects a document (approval workflow). *Only for jobs with approval workflow active, otherwise it will return 0
Parameters
reason (string): Reason why the document is rejected
Returns: 1 = True, 0 = False
ChronoScan Enterprise only.
Example
res = ChronoDocument.Reject("Wrong department")
short
RemoveAllBookmarks
(string bookmarkName = "*")
Removes all the bookmarks of the document, or only the ones with the given name.
short
ReplacePageFile
(short page, string newFile, short cleanOcr = 0)
Since v1.0.2.95
It replaces a page source file
Parameters
page (short): Page number
file (string): Path to file
Returns: 0: fail, 1: success
Example
ChronoDocument.ReplacePageFile(0, "path/to/file")
void
reprocess
()
Reprocess the current Document object
ChronoScan Enterprise only.
Example
 If Not UserField_Invoice_Total.ValidateStatus = 1 Then Call ChronoDocument.reprocess
void
reprocessAfterMasterKey
()
Reprocesses the document after the masterkey has been set (masterkey setups): detects the document type again and reads the fields.
void
resetdocument
()
Resets the document: clears the values read and the processing results so it can be processed again from scratch.
short
RotatePage
(short page, short degrees)
Rotates a page (1-based) clockwise: degrees 90, 180 or 270 (-90 = 270). The OCR of the page is deleted. Returns 1 if rotated.
short
SaveToPDF
(string pdfFile, short includeText = 1, string pdfType = "ChronoScan", short useOriginalPages = 0)
Save the document to a pdf file
Parameters
pdfFile (string): Pdf file
includeText (short) optional: 1=include text, 0=exclude text (default 1)
pdfType (string) optional: "ChronoScan", "Nuance" (default "ChronoScan")
useOriginalPages (short) optional: use original pages. 0 or 1 (default 0)
Returns: 1 = True, 0 = Error
ChronoScan Enterprise only.
Example
'This will save the current document inside the specified path
ChronoDocument.SaveToPDF("c:\temp\file saved from vbscript.pdf")
short
SendToRevise
(string reason = "")
Since v1.0.2.96
Sends a document to revise again (manual_index). *Only for jobs with approval workflow active, otherwise it will return 0
Parameters
reason (string): Reason why the document is sent to revise again
Returns: 1 = True, 0 = False
ChronoScan Enterprise only.
Example
res = ChronoDocument.SendToRevise("Wrong balance")
void
set_doctype_param
(string param, string value)
Set a document type custom value
Parameters
param (string): Name of the item to set
value (string): Value of the item to set
Example
Call Document.set_doctype_param("CALCTAXES", "true")
void
set_masterkey_param
(string param, string value)
Set a master key custom value
Parameters
param (string): Name of the item to set
value (string): Value of the item to set
Example
Call ChronoDocument.set_masterkey_param("CURRENCY", "EUR")
short
SetApprover
(string userid)
Since v1.0.2.96
It sets an specific user as an approver for the current ChronoDocument (enterprise)
* The job must have approval workflow active
* The user id must be a valid approver user for this job
Parameters
userid (string): User id
Allowed values: Must be a valid user id that is an approver for this Job
Returns: 1 = True, 0 = False
ChronoScan Enterprise only.
Example
res = ChronoDocument.SetApprover(user_id)
short
SetCaptureAreaColor
(string FieldName, long color)
Sets the highlight color of the capture area shown in the viewer when the field is selected (color as in VBScript RGB(r,g,b)). Pass -1 to restore the default color.
short
SetDocumentAsIndexed
()
Set document as indexed in a ENT system
Returns: 1 = True, 0 = Error
ChronoScan Enterprise only.
Example
res = ChronoDocument.SetDocumentAsIndexed()
short
SetDocumentAsManualIndex
()
Marks the document as manually indexed (no automatic reading will overwrite its fields).
short
SetDocumentType
(string TypeName)
Forces a document type
Parameters
TypeName (string): Document type name
Returns: 1 = True, 0 = False
Example
res = ChronoDocument.SetDocumentType("DOCUMENT TYPE NAME")
short
SetEntStatus
(string status)
Since v1.0.2.96
It sets an enterprise document status
Parameters
status (string): Status to set
Allowed values: unknown, increation, created, pre_class, reprocess, processed, post_class, configured, corrected, approved, exported, export_error_status, archived, parked, processing_error, waiting_approval, rejected, ready_to_export, waiting_external_actions
Returns: 1 = True, 0 = False
ChronoScan Enterprise only.
Example
res = ChronoDocument.SetEntStatus("toreview")
short
SetFieldValue
(string fieldName, string fieldValue)
Sets the value of a field of the document. Returns 1 on success. (Replaces the old set_field_value.)
short
SetIntellitagCandidate
(string fieldName, short page, string value)
Applies one of the I-Tag candidates of the field (page 1-based and value as listed by GetIntellitagCandidates; empty value = best candidate of the page, page 0 = any page) as if the I-Tag had chosen it. Returns 1 if applied.
short
SetPageColor
(short page, short r, short g, short b)
Sets the background color (r, g, b) of a page thumbnail (page 1-based).
void
SetPageFieldValue
(short page, string FieldName, string FieldValue)
Sets the value of a page field (page 1-based).
short
SetXgridColumnValue
(short GridPanel, short row, short col, string value)
Sets the value of a cell of a grid panel by column index. The return value is reserved.
short
SetXgridFieldColor
(short GridPanel, short row, string FieldName, long color)
Set the color of a specific capture grid field
Parameters
GridPanel (short)
Allowed values: 1, 2, 3, 4
row (short): Table row number (0 based)
FieldName (string): Field name
color (long): -1 = Removes the color to default
RGB(red,green,blue) to specify a color
Returns: 1 = True, 0 = False
Example
' 'Grid 1, Row 3, Field "Details line" and RGB color 0,255,0 (Green)
Call ChronoDocument.SetXgridFieldColor(1, 3, "Details line", rgb(0,255,0))
short
SetXgridFieldValue
(short GridPanel, short row, string FieldName, string value)
Set the value for a specific capture grid field
Parameters
GridPanel (short)
Allowed values: 1, 2, 3, 4
row (short): Table row number (0 based)
FieldName (string): Field name
value (string): New value to set
Returns: 1 = True, 0 = False
Example
Dim r
r = ChronoDocument.SetXgridFieldValue(1, 0, fieldName, newValue)
short
SplitOnPage
(short page)
Splits a document in a specific page
Parameters
page (short): Page number (0 based)
Returns: 1 = True, 0 = False
Example
Dim res
res = ChronoDocument.SplitOnPage(0)
void
Validate
()
Forces validation
Example
Call ChronoDocument.Validate()
void
XgridClearContent
(short GridPanel)
Clear capture grid content
Parameters
GridPanel (short)
Allowed values: 1, 2, 3, 4
Example
ChronoDocument.XgridClearContent(1)
 
Examples
Example 1 (GetIntellitagCandidates)
Get candidates for the AllowCharge intelli-tag list with option 1 which means removing duplicates by choosing the one with the highest score
candidatesArray = ChronoDocument.GetIntellitagCandidates("AllowCharge",1)
 
'Put the results on xgrid 2
xgridNum=2
 
Call ChronoDocument.XgridClearContent(xgridNum)
 
For i = 0 To UBound(candidatesArray)
 
        Call ChronoDocument.AddXgridRow(xgridNum)
        Call ChronoDocument.SetXgridFieldValue(xgridNum, i, "DESCRIPTION", candidatesArray (i,0))
        Call ChronoDocument.SetXgridFieldValue(xgridNum, i, "TOTAL AMOUNT", candidatesArray (i,2))
        Call ChronoDocument.SetXgridFieldValue(xgridNum, i, "Page Number", candidatesArray (i,3))
 
        'Set CODE in Grid 2 according to Credit field. This uses the User Values that can be added to any intelli-tag
        If UserField_Credit.value="no" Then
                Call ChronoDocument.SetXgridFieldValue(xgridNum, i, "CODE", candidatesArray (i,6))
                ElseIf UserField_Credit.value="yes" Then
                Call ChronoDocument.SetXgridFieldValue(xgridNum, i, "CODE", candidatesArray (i,7))
        End If
 
Next