Open and modify file .DBF

Hi All,

I am studying the Cicode of a project.  In the Cicode, use "DevOpen" to open a device file. The file is formatted in *.DBF.

How to open and modify this file?

For example, in the picture, using DevOpen to open the Table_AHU_Dev2.

How to open, view and modify Table_AHU_Dev2.dbf file?

Parents
  • For viewing and modifying dbf files outside of Citect, you can use Excel and install the Citect DBF Add-In (works only in 32-bit versions of MS Office).

    For viewing (and modifying) dbf files in Citect using a grid on a page, you can use the DatabaseExchange ActiveX control. See this help page for more info: https://gcsresource.aveva.com/plantscada/WebHelp/plantscada2020R2/Content/Add_a_Database_Exchange_Control.html?Highlight=database%20exchange

    For opening dbf files in cicode and perform operations on a record- and field-base, you are on the right track in your screen shots.

    The device you want to open has to be defined in Citect first as a Device under Setup > Devices. Please check the help on this topic: https://gcsresource.aveva.com/plantscada/WebHelp/plantscada2020R2/Content/Add_a_Device.html

    Then use DevOpen(sDevName, [nMode]) to open the device, where nMode is an optional mode for opening. See https://gcsresource.aveva.com/plantscada/WebHelp/plantscada2020R2/Content/Cicode/DevOpen.html?Highlight=devopen for help on this function.

    For help on reading and writing data you could check the help here: https://gcsresource.aveva.com/plantscada/WebHelp/plantscada2020R2/Content/Using_a_database_device.html

    For complete examples on how to use these techniques you can also check the Example project that comes with Citect.

  • Another good option for viewing/editing DBF files outside of Citect is OpenOffice or LibreOffice Calc. It's free and doesn't require an add-in to support DBF files. 

  • I always stay away from OpenOffice because it doesn't handle foreign/special characters very well. At least that was the case the last time I tried several years ago.

  • Interesting.  Every time I open a DBF with it I get this:

    Which, TBH, I find a bit annoying, because I never change it.  I presume that this would have an impact on how the characters were imported and interpreted?  Being from somewhere where diacritics and the like are a real novelty, we are either fortunate or spoilt I suppose.

    Of course, it is also likely I have no idea what the problem is.

  • I can't remember seeing this dialog in the OO version I tried back in the days. Maybe worth another look. Do you know whether OO will re-index a dbf that has an index file (ndx)? I know the Excel Add-In does that perfectly. And in our own tooling we accomplish this as well by calling ReIndex.exe from the Citect bin folder.

Reply
  • I can't remember seeing this dialog in the OO version I tried back in the days. Maybe worth another look. Do you know whether OO will re-index a dbf that has an index file (ndx)? I know the Excel Add-In does that perfectly. And in our own tooling we accomplish this as well by calling ReIndex.exe from the Citect bin folder.

Children