Thanks for raising this issue. I have just tried it myself with the latest version of the NBN Exchange Addin (v6.13.0.14).
I too found that only the location name in the sample location name field is extracted and not the site name in the location hierarchy.
Initial versions of the addin concatenated these two fields together into one 'SiteName' field, but this approach lead to duplication of the site name. The latest version of the addin takes a slightly different approach, populating the sitename field with the details of the location name in the sample location name field (STEP 1), then if this is empty, populating the sitename field with the site name in the location hierarchy (firstly tries to do this by linking from the Sample table (STEP2) and if still empty then tries it linking from the Survey Event table (STEP3)). The problem is that the addin is doing the STEP 1 ok but not STEP 2 or STEP 3.
To solve this I edited the stored procedure (nbn_exchange_basic_update) which run the T-SQL to do these steps, adding “OR LEN(SiteName) =0” to the where clauses as shown below.
-- *********
-- Site Name
-- *********
-- Get the SiteName from the LOCATION_NAME where we can
UPDATE ##nbn_exchange_obs
SET SiteName = SAMPLE.LOCATION_NAME
FROM ##nbn_exchange_obs INNER JOIN
SAMPLE ON ##nbn_exchange_obs.SampleKey = SAMPLE.SAMPLE_KEY;
-- If it is still null, try getting it from the SAMPLE.LOCATION_KEY
UPDATE ##nbn_exchange_obs
SET SiteName = LOCATION_NAME.ITEM_NAME
FROM ##nbn_exchange_obs INNER JOIN
SAMPLE ON ##nbn_exchange_obs.SampleKey = SAMPLE.SAMPLE_KEY
INNER JOIN LOCATION_NAME ON SAMPLE.LOCATION_KEY = LOCATION_NAME.LOCATION_KEY AND LOCATION_NAME.PREFERRED = 1
WHERE SiteName Is Null OR LEN(SiteName) =0;
-- Finally, try getting it from the SURVEY_EVENT.LOCATION_KEY
UPDATE ##nbn_exchange_obs
SET SiteName = LOCATION_NAME.ITEM_NAME
FROM ##nbn_exchange_obs INNER JOIN
SAMPLE ON ##nbn_exchange_obs.SampleKey = SAMPLE.SAMPLE_KEY
INNER JOIN SURVEY_EVENT ON SAMPLE.SURVEY_EVENT_KEY = SURVEY_EVENT.SURVEY_EVENT_KEY
INNER JOIN LOCATION_NAME ON SURVEY_EVENT.LOCATION_KEY = LOCATION_NAME.LOCATION_KEY AND LOCATION_NAME.PREFERRED = 1
WHERE SiteName Is Null OR LEN(SiteName) =0;
I will raise this issue with JNCC so that this is changed for the next release of Recorder. In the meantime if you can not change the stored procedure yourself then my other suggestion is to run the NBN Exchange Format addin as normal, and then additonally run an export using the wizard to extract the site name along with the taxonoccurrencekey, this can then be merged back in the NBN Exchange Format file. To do this I exported the taxonoccurencekey (=obskey), location name field (=Sample location Name or Event Location name) and sitename in location hierarchy (=Sample location or Event location). These additional columns then need to be concatenated together and put in with the other NBN Exchange fields. This can be a bit fiddly so I can help with this step if you wish.
Finally in the NBN Exchange Format the sitename is an optional field and so may be excluded altogether.
Hope this helps
Graham