Why would the node always show my gdp and not the name?

Hi there,

I have the problem, when importing my csv I always get the gdp in my node visualized. I actually want the economy_name in the center.

Thanks!

LOAD CSV WITH HEADERS FROM 'file:///csv/economy.csv' AS row
CREATE (n:Economy)
SET n.economy_name = CASE WHEN row.country IS NOT NULL AND row.country <> '' THEN "Economy_" + row.country ELSE NULL END,
    n.gdp = CASE WHEN row.gdp IS NOT NULL AND row.gdp <> '' THEN toInteger(trim(row.gdp)) ELSE NULL END,
    n.agriculture = CASE WHEN row.agriculture IS NOT NULL AND row.agriculture <> '' THEN toFloat(trim(row.agriculture)) ELSE NULL END,
    n.service = CASE WHEN row.service IS NOT NULL AND row.service <> '' THEN toFloat(trim(row.service)) ELSE NULL END,
    n.industry = CASE WHEN row.industry IS NOT NULL AND row.industry <> '' THEN toFloat(trim(row.industry)) ELSE NULL END,
    n.inflation = CASE WHEN row.inflation IS NOT NULL AND row.inflation <> '' THEN toFloat(trim(row.inflation)) ELSE NULL END,
    n.unemployment = CASE WHEN row.unemployment IS NOT NULL AND row.unemployment <> '' THEN toFloat(trim(row.unemployment)) ELSE NULL END;

I also found that you can click in the UI and manually change the attribute that should get displayed. Im looking for a solution where I can set this already while importing the file.

Hello.

The property to show as caption of the nodes is not part of the database or the graph, it is just a part of the visualisation tool ("Browser" in this case).

The properties are all equal, there is no "master" property. You can have uniqueness constraints and indexes on properties, but no property is deemed the caption. So when you import the data, there is nothing special you can do.

Once you visualise the graph in Browser it randomly picks a property to show as the caption. It will remember it, though, so if you pick one (as you showed above) it will be remembered next time you go there. And if you drop your graph and re-import it, it will also remember visualisation settings such as caption, color and size of the nodes.

There is also the possibility to style Neo4j Browser using a settings file called GraSS, as you can see that the bottom of this page:

Alright, thank you for your efforts :slight_smile: