Solved How to import a CSV file? Invalid XID Reference problem
-
I tried to use Configuration Import function to import a CSV file, but the message blocks shown Invalid XID Reference. I think this problem may be caused by no data source were created for these Export ID. I do not know how to build a data source and use it to contact to the CSV file. Could anyone who know this problem teaching me how to import CSV file into Mango Automation. I greatly appreciate for your help.
-
@tangyiping are you going to use the data file datasource? or are you using the import/export page for batch inserting new datapoints?
Going to need more information. If you're importing/creating datapoints dynamically, it makes more sense to use JSON as it's a cleaner format and easier to follow. An invalid XID reference would be referring to the points themselves. Can't map values to a datapoint that does not exist, doubly so for a dataSourceXid value. -
Hi Thanks for your response. I am using Import/Export function to import a CSV file. But this function did not create a data source automatically for me. After clicking import, it just shows me Invalid XID Reference. Could you just briefly explain to me the steps to successfully import a CSV file to Mango?
-
Hi tangyiping, welcome to the forum!
You are attempting to create data points by impoting the CSV, or you are trying to import point values through CSV? It sounds like you're trying to create data points through CSV, not point values. If it is point values, you should look into the /dataImport.shtm page. The format expected by this page is the same format downloaded on the chart at /data_point_details.shtm
For data points, the easiest way to see the correct format to for a data point is to export an existing data point on the /data_sources.shtm page using the export CSV button:
Which can then be imported on the /emport.shtm page after the import type has been changed from JSON to CSV.
I do agree with Matt that if you come to familiarize yourself with working with JSON, you will come to see that it's a better option, since everything is supported and there are ways to deal with unbounded lists.
-
@phildunlap Hi Thanks for your response. I am a beginner for Mango. I am sorry for my unclear questions.
I am trying to create data values by importing the CSV file. According to your suggestion, I changed to /dataImport.shtm page to import CSV file. But, the page warns me that Number of headers is invalid. Expected 29 but 8. Do you know how to solve this problem? Also, in the file type selection, I only find CSV and Excel types are available to be imported to Mango. How to import a JSON file in /dataImport.shtm page? My Mango version is 2.8.6. Thanks so much for your help!!
-
@tangyiping your CSV needs to be in the exact same format as provided in the samples including the time stamps. Make sure to click the "?" icon on the page to see the examples and the formats. There is no option to import point values from JSON with this tool. Thanks.