This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

WaterObjects.NET How to get fieldcollection / List of fields for a domain element?

Dear Yashodhan & Jesse,

    I am trying to get list of field names for a specific domain element e.g. Junction , in WaterObjects.NET. But I am unable to get correct results. In the following code, dset.FieldManager loop 

    is not fetching any results.

Dim dset As IdahoDomainDataSet = adataSource.DomainDataSetManager.DomainDataSet(1)

For Each dataSetType As IDomainDataSetType In adataSource.SupportedDataSetTypes()

   For Each domainElementType As IDomainElementType In dataSetType.DomainElementTypes()
      MessageBox.Show(domainElementType.Name)
      For Each field As IField In dset.FieldManager.DomainElementFields(domainElementType.Id) 'Not fetching any results
            MessageBox.Show(field.Name)
      Next

   Next
Next

    I also tried using SupportedFields and SupportedResultFields on DomainElementManager. Though it is fetching field names, the list is not complete. Like for Junction, it is not showing HGL.

Regards,

Devashri

Parents
  • Hi Devashri,

    You need to make sure you are referencing all the necessary assemblies for the result fields to be retrieved correctly.

    You would typically need to reference any DLL with "Haestad.Calculations.*.Domain.dll" in the name.  The "*" is a wild card.  For example, to get result fields associated with the EpaNetEngine, make sure you reference Haestad.Calculations.Pressure.Domain.

    See the WaterObjects sample, WaterObjects.NET.ResultsRangeFinder under the references node for all the DLLs that I suggest you add as a reference in your VB project.

    In addition, I recommend you use SupportedResultFields() on an IDomainElementManager.  That is the east way to get a list of result fields.

    Note: The field name for a junction's HGL result field is IdahoNodeResults_NodeHgl.

    I hope that helps.

    Kris Culin

    Senior Software Developer, Water Infrastructure

    Bentley Software

  • Hi Kris,

    Thanks for your response. But as I mentioned in yesterday's post, I actually tried executing ResultRangeFinder tool, both from visual studio and from WaterGEMS as an external tool. But it failed to fetch the field list and the field drop down is null. It throws the following exception in Visual Studio,

    "Exception in IdahoFieldManager.ResultFields: ApplicationException: An error occured while loading the Numerical Engine class for engine type named EpaNetEngine."

    What can be the probable reason for this ?

    Regards

    Devashri

  • Hi Devashri,

    The exception indicates that It is not finding Haestad.Calculations.Pressure.Domain.dll.  If you are running WaterGEMS from the shortcut it is more than likely running the 64-bit version.  This means when you build the ResultRangeFinder tool you need to build it in x64.  Then copy the exe it generates into the x64 folder of the WaterGEMS installation folder (typically this would be C:\Program Files (x86)\Bentley\WaterGEMS which has an x64 folder in it).  Then run the ResultRangeFinder.exe from that location as an external tool.

    In the RangeFinnderTool make sure the references point to the correct location based on what platform you are building.  When building in x86, it should point to C:\Program Files (x86)\Bentley\WaterGEMS.  If you build in x64, then you need to point to C:\Program Files (x86)\Bentley\WaterGEMS\x64.  You can set the References path in the project options without removing/re-adding references.

    Feel free to ask any more questions if you still have issues.

    Kris Culin

    Senior Software Developer, Water Infrastructure

    Bentley Software

    Answer Verified By: Devashri Karve 

  • Dear Kris!!!!

    A Zillion Thanks! It worked perfectly! Awesome! :) 

    Thanks again!!!

    Regards,

    Devashri + Team DTK

  • Thank you too, Jesse and Yashodhan !!!

Reply Children
No Data