Skip to content


Object reference not set to an instance of an ojbect

Andy asked 4 years ago
I currently get an excel file of assets that are created in a different system.  My goal is to import those assets in to GP as long as they don’t already exist in gp.  The asset label will be the same in GP as they are in my excel file, but the asset ID’s could be different.  I am trying to do a multiple data source load the links the excel file and the fa00100 table and only grabs assets from the excel file that don’t exist in the gp table.  I am getting an error like this: Failed to get data from multiple sources: “Object reference not set to an instance of an object” when I try doing an outer join between the two sources.  Any ideas what is causing this, or is there a better route for me to only grab new assets? 
Ethan Sorenson Staff answered 4 years ago
Using a Multi data source is the best way to create a map that only creates new records and not update.
Make sure the Excel file is closed before you try to preview your data source or run the map. If the file is open you can see connection errors similar to this one.
Another possibility is there is an issue with the name of a field in your file. Make sure there aren’t any special characters or spaces in your column headers and try again.
Andy Berntson replied 4 years ago

Hi Ethan,

could it possibly have anything to do with the actual data that is stored in the asset_label field? I have tried multiple approaches and it just won’t let me use the asset_label field. It has no problem if i use the assetid field, but that wont’ work for my scenario.

tony answered 3 weeks ago

In a nutshell it means.. You are trying to access an object without instantiating it.. You might need to use the “new” keyword to instantiate it first i.e create an instance of it. An Object is an instance of a Class , it is stored some where in memory. A reference is what is used to describe the pointer to the memory location where the Object resides. The message “object reference not set to an instance of an object” means that you are referring to an object the does not exist or was deleted or cleaned up. It’s usually better to avoid a NullReferenceException than to handle it after it occurs. To prevent the error, objects that could be null should be tested for null before being used.

if (mClass != null)
// Go ahead and use mClass = …
// Attempting to use mClass here will result in NullReferenceException


If you would like to submit an answer or comment, please sign in to the eOne portal.