innovyze / Open-Source-Support

This repository hosts open code that can be used in Innovyze products that support scripting. This includes Ruby for the UI/Exchange, SQL and other useful stuff. We stand on the shoulders of badgers and penguins.
44 stars 20 forks source link

Failed to import pollutant data #3

Closed KillDragon closed 2 years ago

KillDragon commented 2 years ago

Dear expert, When I used exchange to import pollutant data, I found that there was no problem with the code, but the imported data was lost in the software. Can you help me solve it? The specific code is as follows:

begin
db=WSApplication.open('snumbat://localhost:40000/train03',false) 
object_path='>MODG~ModelGroup'
puts object_path
mo=db.model_object(object_path) 
#mo=mo.import_new_model_object(type,name,format,filepath,0)
name='ceshi'
b=mo.import_new_model_object('Pollutant graph',name,'COD',"C:\\temp\\p2_COD.csv",0)
b.import_data('BOD',"C:\\temp\\p2_BOD.csv")
puts 'success'
rescue 
puts "#{$!}"
end

image

Thank you very much for taking the time to check my questions

dfmore commented 2 years ago

@KillDragon thanks for this question. The issue seems to be in line 8 of your code. The import_new_model_object method was set to read a COD file that is of the InfoWorks file format. Such file would end with *.cod extension and has a specific structure. However, the method was set up to expect a CSV type file named p2_COD.csv.

See the two export types below: image

I think you've since also submitted it as a support inquiry via our support portal and I've replied there. Apologies for the late reply here, it's still a learning curve for us using GitHub and we didn't have alerts set up for Issues yet.

KillDragon commented 2 years ago

Thank you for your reply