# Return hyperlinks with UNWIND

**URL:** https://community.neo4j.com/t/return-hyperlinks-with-unwind/73101
**Category:** Cypher
**Tags:** unwind
**Created:** [March 20, 2025, 12:14pm UTC](https://community.neo4j.com/t/return-hyperlinks-with-unwind/73101 "2025-03-20T12:14:24Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![guido](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/guido/32/27515_2.png) [@guido](https://community.neo4j.com/u/guido)
#### Post date: [March 20, 2025, 12:14pm UTC](https://community.neo4j.com/t/return-hyperlinks-with-unwind/73101/1 "2025-03-20T12:14:24Z")

</div>

In the following query:

```auto
MATCH (s:Source)
WITH [ "TITLE: " + s.title,
       "SUBTITLE: " + s.subtitle,
       "TYPE: " + s.type,
       "DEGREE: " = s.degree,
       "YEAR: " + s.year,
       "LANGUAGE: " + s.language,
       "APPEARED IN: " + s3.title,
       "ISBN: " + s.ISBN,
       "URL: " + s.url,
       "Comment: " + s.comment,
       "STCV: " + s.STCV,
       "WikiData: " + s.wikidata,
       "SourceID: " + s.sourceID
 ] as allData
WITH [i in allData where not i ends with ': '] as data
UNWIND data as INFORMATION
RETURN INFORMATION

```

s.STCV and s.URL should be returned as hyperlinks but they are returned as strings.  
('''RETURN s.STCV, s.URL''' does yield hyperlinks)

How to fix this? Thanks for any suggestion!

---

<div class="post-metadata">

### Author: ![glilienfield](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/glilienfield/32/27534_2.png) [@glilienfield](https://community.neo4j.com/u/glilienfield)
#### Post date: [March 20, 2025, 1:14pm UTC](https://community.neo4j.com/t/return-hyperlinks-with-unwind/73101/2 "2025-03-20T13:14:04Z")

</div>

Maybe if you return the value separately it will be interpreted as a hyperlink.

```auto
MATCH (s:Source)
WITH {
    TITLE: s.title,
    SUBTITLE: s.subtitle,
    TYPE: s.type,
    DEGREE: s.degree,
    YEAR: s.year,
    LANGUAGE: s.language,
    APPEARED_IN: s.title,
    ISBN: s.ISBN,
    URL: s.url,
    Comment:s.comment,
    STCV: s.STCV,
    WikiData: s.wikidata,
    SourceID: s.sourceID
} as allData
UNWIND keys(allData) as key
WITH key, allData[key] as property
WHERE property IS NOT NULL
RETURN *

```

You can do the following if the node's property names are the same as the labels you want to return:

```auto
MATCH (s:Source)
UNWIND keys(s) as key
RETURN key, s[key] as property

```

---

<div class="post-metadata">

### Author: ![guido](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/guido/32/27515_2.png) [@guido](https://community.neo4j.com/u/guido)
#### Post date: [March 20, 2025, 3:16pm UTC](https://community.neo4j.com/t/return-hyperlinks-with-unwind/73101/3 "2025-03-20T15:16:28Z")

</div>

Wirks perfectly, thanks (again)!

---

<div class="post-metadata">

### Author: ![guido](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/guido/32/27515_2.png) [@guido](https://community.neo4j.com/u/guido)
#### Post date: [March 24, 2025, 3:45pm UTC](https://community.neo4j.com/t/return-hyperlinks-with-unwind/73101/4 "2025-03-24T15:45:55Z")

</div>

One more question, though.  
I want the fields to appear exactly in the order in which they are listed in the WITH clause:

```auto
    TITLE: s.title,
    SUBTITLE: s.subtitle,
    TYPE: s.type,
    DEGREE: s.degree,
    YEAR: s.year,
    LANGUAGE: s.language,
    APPEARED_IN: s3.title,
    ISBN: s.ISBN,
    URL: s.url,
    Comment:s.comment,
    STCV: s.STCV,
    WikiData: s.wikidata,
    SourceID: s.sourceID

```

In your query, however, the order has been randomized:

 ![image](https://us1.discourse-cdn.com/flex021/uploads/neo4jcommunity/original/3X/3/a/3acbd9ac529dc4090d5b598dd0b515b789d96c26.png)

---

<div class="post-metadata">

### Author: ![glilienfield](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/glilienfield/32/27534_2.png) [@glilienfield](https://community.neo4j.com/u/glilienfield)
#### Post date: [March 24, 2025, 10:54pm UTC](https://community.neo4j.com/t/return-hyperlinks-with-unwind/73101/5 "2025-03-24T22:54:55Z")

</div>

The node's properties are stored in a hash map, which does not maintain any predicable ordering. You can define the sort order of the properties and use this list to drive the ordering of the output.

```auto
WITH ['title', 'subtitle', 'type', 'degree', 'year', 'null_property'] as keysByOrder
MATCH (s:Source)
UNWIND keysByOrder as key
WITH key, s
WHERE s[key] IS NOT NULL
RETURN toUpper(key), s[key] as property

```

 ![Screenshot 2025-03-24 at 6.52.07 PM](https://us1.discourse-cdn.com/flex021/uploads/neo4jcommunity/original/3X/f/c/fc480f3c43b2148416b6cd5a5826ac2a3cfc2323.png)
