Posted Fri, 21 Feb 2014 13:16:37 GMT by Niels Jensen
Does anyone know a smart way to make a large number of txt files into dfs0 files.
Preferably in a non-manual way.
The txt files contain only a time series with a water level. Two columns copied from Excel
Posted Mon, 03 Mar 2014 10:01:33 GMT by Vianney Courdent
Hey Niels,

I would advice you to use Mike SDK (Software Development Kit) which is automatically installed with MU 2014. I guess that you should be able to download it if you use a older version of MU.

Mike SDK gives you access to .NET libraries to handle dfs files (create, happens, read ...). So you need to use a .NET oriented programming langue as C# or IronPyton to write you program (Matlab  should also work). There are some examples inside the Mike SDK directory.

I am doing it with IronPython and it works just fine.

I hope it helps,

Posted Wed, 04 Nov 2015 14:13:30 GMT by JakubVajda

if you are VB Friendly, here you are :)
It is a function you can call from MS Access Report or slightly change it to run in vbscript...

Option Compare Database

Public Function CreateDFS(StationName As String, ItemName As String, EumType As Double, ItemType As Double, TimeField As String, ValueField As String) As String

Dim TSValue As Double
Dim TSDate As Date
Dim TS As TSObject
Dim TimeVar As Date
Dim Item As TSItem

Dim RS As Recordset 'Managing timeseries
Dim SQL As String
    SQL = "SELECT " & StationName & ".Profile FROM " & StationName & " GROUP BY " & StationName & ".Profile;"
Set RS = CurrentDb.OpenRecordset(SQL)
Dim Serie As Variant 'setting dfs0 series names to var Serie
    With RS
        Serie = .GetRows(.RecordCount)
    End With

Dim Count As String
Set RS = CurrentDb.OpenRecordset(StationName)
    For Each Ser In Serie
        Set TS = New TSObject
        TS.Time.TimeType = Non_Equidistant_Calendar
        Set Item = TS.NewItem
        TS.Item(1).Name = ItemName  'name of station - set to TS_name ?
        TS.Item(1).ValueType = Instantaneous
        TS.Item(1).EumType = EumType  'select from table > DataType <
        TS.Item(1).EumUnit = ItemType 'default - (jav) ask programmers...
        TS.Connection.FileTitle = Ser
        RS.Filter = "Profile = '" & Ser & "'"
        Set RSfiltr = RS.OpenRecordset
        Count = RSfiltr.RecordCount  'Counting
        RSfiltr.Sort = "[" & TimeField & "]"
        For i = 1 To Count 'stepping on rows & copying values to DFS object
            TS.Time.AddTimeSteps 1
            TSDate = RSfiltr(TimeField)
            TS.Time.SetTimeForTimeStepNr i, TSDate
            TSValue = RSfiltr(ValueField)
            TS.Item(1).SetDataForTimeStepNr i, TSValue
        'Finishing & saving the file
        TS.Item(1).DataType = Type_Float
        TS.Connection.FilePath = "C:\_Model\Calibration\Data\" & Ser & ".dfs0"
    Next Ser
Set RS = Nothing
End Function

You must be signed in to post in this forum.