Last active
July 5, 2016 09:10
-
-
Save coramuirgen/d4f298c49292f168f78c21592eb8dcb4 to your computer and use it in GitHub Desktop.
Records Input Parse
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public Function PrepareFromInput(inputrecords As QueryableRecords, inputhasheader As RecordsHeaderType, ParamArray paraminput() As Variant) As QueryableRecords | |
On Error GoTo ErrHandler | |
' Input data supported: | |
' scalar value(s) | |
' arrays (single/multi dimensional) | |
' tuples (2-index) | |
' assocs (value must be scalar) | |
' lists/collections/enumerables/iterables | |
' map objects like Scripting.Dictionary (key:column name)/(value: field value or column of field values) | |
' ado/dao recordsets | |
' ms access tables/queries (as tabledef/querydef) | |
' nested data 2 levels deep, i.e. an enumerable container of a supported type (containing finally scalars) | |
' To add columns only, add in this.Columns | |
Dim inputdata As Var | |
Set inputdata = Var.Create(CVar(paraminput)) | |
If Not ImportDataSupported(inputdata) Then | |
Err.Raise UNIMPLEMENTED | |
End If | |
Set inputrecords = PrepareEmpty(DefaultStorageModeOf(inputdata)) | |
Set inputrecords = Append(inputrecords, inputhasheader, inputdata) | |
Set PrepareFromInput = inputrecords | |
CleanExit: | |
Exit Function | |
ErrHandler: | |
'Application.Run "LogEvent", "error", "Records", "Create", , Erl(), Err.number, Err.Description | |
Resume CleanExit | |
Resume | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment