How can I change the dynamic item properties in a dfs file?

You can edit the item properties by opening the file in the related file editor, or open the file in MzDataUtility - see Fig. 1.


Fig. 1 - Time editing


If you need to change several files it may be feasible to use MIKE Core SDK to create a small tool that can update the item properties for a given dfs file (dfs0/dfs1/dfs2/dfs3/dfsu).

(MIKE Core SDK is a free software development kit that allows you to easily write code that accesses and produces files in the main MIKE data formats.)

Updating the item properties in a file requires input of 5 parameters: the filename of the dfs file to be modified, the item number, the item name, the item type and the item unit. 

An example of the source code for such a tool looks as follows:


using System;

using DHI.Generic.MikeZero.DFS;


namespace DHI.Generic.MikeZero.DFSTest


   class Program


      /// <summary>

      /// Static constructor, setting up search paths for MIKE assemblies

      /// </summary>

      static Program()


         // The setup method will make your application find the MIKE assemblies at runtime.

         if (!DHI.Mike.Install.MikeImport.Setup(20, DHI.Mike.Install.MikeProducts.Mike1D))

            throw new Exception("Could not find a MIKE installation");



      /// <summary>

      /// Updates the item name, Eum item type and Eum item unit for a certain dynamic item in a dfs file

      /// </summary>

      /// <param name="filename path" itemnumber "name"  "eumType" "eumUnit"</param>

      public static void Main(string[] args)


         string filename = args[0];

         int itemno = Int32.Parse(args[1]);

         string newItemName = args[2];

         eumItem newEumType = (eumItem)Enum.Parse(typeof(eumItem), args[2]);

         eumUnit newEumUnit = (eumUnit)Enum.Parse(typeof(eumUnit), args[3]);


         IDfsFile dfsFile = DfsFileFactory.DfsGenericOpenEdit(filename);

         if (itemno == 0)    // all items
            for (int i = 0; i < dfsFile.ItemInfo.Count; i++)            
               IDfsDynamicItemInfo itemInfo = dfsFile.ItemInfo[i];
               itemInfo.Quantity = eumQuantity.Create(newEumType, newEumUnit);
         else    // one item
            itemno = itemno - 1;                               // item array start from 0
            IDfsDynamicItemInfo itemInfo = dfsFile.ItemInfo[itemno];

            // Update the name and item properties, e.g. (eumItem.eumIFlowFlux, eumUnit.eumUm3PerSecPerM)
            itemInfo.Name = newItemName;
            itemInfo.Quantity = eumQuantity.Create(newEumType, newEumUnit);







The build statement to create the executionable ‘ChangeStartTime.exe’ looks as follows:


set csc=C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe
set sdkBin=C:\Program Files (x86)\DHI\MIKE Core SDK\2022\\bin\x64
%csc% /r:"%sdkBin%\DHI.Generic.MikeZero.DFS.dll" /r:"%sdkBin%\DHI.Generic.MikeZero.EUM.dll" /r:"%sdkBin%\DHI.Mike.Install.dll" /r:"netstandard.dll"  ChangeItemInfo.cs


NOTE: This exe-file can be used to change the item properties a file via a simple command.

E.g. to change the item name and item properties for the second item in the file “file.dfsu” to reflect a water level, the command would be:

ChangeItemInfo.exe file.dfsu 2 "Water level" eumIWaterLevel eumUmeter


E.g. to change the item properties for all items in the file “file.dfsu” to reflect water levels, the command would be (the item names will not be changed):

ChangeItemInfo.exe file.dfsu 0 "dummy" eumIWaterLevel eumUmeter


Manuals and User Guides
MIKE Core SDK Documentation Index
MZ Data Utility Online help

Release Notes
MIKE Core SDK Release Note

Related Products: MIKE 21/3, MIKE SHE, MIKE+