CasewareDocs

AliasHasMatch

Gets a boolean that indicates whether the alias has a match in the set of input files.

It can be helpful to those Standard Import Routine subtasks that are executed before the files were imported.

Compatibility

Available as of IDEA version 9.1.1

Syntax

AliasHasMatch()

Remark

This property is read-only.

Example

Option Explicit

'Importfiles, ISimpleImportFiles, ISimpleImportFile
'Gets a reference to the collection of file descriptors of the current CIR or extension.
Sub Main()
'Importfiles
Dim importfiles As Variant
Set importfiles = SmartContext.ImportFiles
Dim txt As String
txt = "Files: "
Dim onefile As Object 'onefile available properties: onefile.Alias, .ImportedFileName, .DatabaseId
For Each onefile In importfiles
Dim filealias As String
filealias = onefile.Alias
txt = txt & " Alias: " & filealias & Chr(13) & Chr(10)

Dim AliasHasMatch As Boolean
AliasHasMatch = onefile.AliasHasMatch
If AliasHasMatch Then
txt = txt & "The table alias was successfully resolved." & Chr(13) & Chr(10)
Else
txt = txt & "The table alias was not successfully resolved." & Chr(13) & Chr(10)
End If

Dim databaseHasBadData As Boolean
databaseHasBadData = onefile.databaseHasBadData
If databaseHasBadData Then
txt = txt & "The associated IDEA database has bad data." & Chr(13) & Chr(10)
Else
txt = txt & "The associated IDEA database has not bad data." & Chr(13) & Chr(10)
End If

Dim databaseIdAsString As String
databaseIdAsString = onefile.databaseIdAsString
txt = txt & " DatabaseIdAsString: " & databaseIdAsString & Chr(13) & Chr(10)
' DatabaseId not available in iss file

Dim databaseRecordCountAsDouble As Double
databaseRecordCountAsDouble = onefile.databaseRecordCountAsDouble
txt = txt & " DatabaseRecordCountAsDouble: " & Str(databaseRecordCountAsDouble) & Chr(13) & Chr(10)

'DatabaseRecordCount not available in iss file

Dim importedFilename As String
importedFilename = onefile.importedFilename
txt = txt & " ImportedFileName: " & importedFilename & Chr(13) & Chr(10)

Dim isSelected As Boolean
isSelected = onefile.isSelected
' This property make sense to be used in premacro, before the import of the files
' for example if one of the optional table was not selected to be imported the user can be announced and he can decide if he want to continue the import or not
If isSelected Then
txt = txt & "The table was selected to be imported" & Chr(13) & Chr(10)
Else
txt = txt & "The table was not selected to be imported" & Chr(13) & Chr(10)
End If
Next

MsgBox txt

'ISimpleImportFiles
'Determines whether the collection contains an element with the specified alias: "DataBaseAlias"
If importfiles.Contains("Alias") Then
MsgBox"The table with alias ""Alias"" is among the files which could be imported"
Else
MsgBox"The table with alias ""Alias"" is not among the files which could be imported"
End If

'Gets the number of elements in the collection.
Dim numberofelements As Long
numberofelements = importfiles.Count
MsgBox"The number of the files which could be imported is: " & Str(numberofelements)
'GetEnumerator - not used in iss file only in c#
'Gets the object with the specified alias or the specified zero-based index.
Dim lastfile As Object
Set lastfile = importfiles.Item(numberofelements - 1)
MsgBox"LastFile:" & lastfile.importedFilename

End Sub