Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
04-26-2022 08:43 PM
match (n:HealthcareServiceRequest) where n.AuthorizationNumber in ['2208390000']
and n.AuthRequestType = '005010X217' and n.EventName = 'Response278'
Match (m:Attachments275) where n.AttachControlNumber = m.AttachmentControlNumber
return m.Attachmentpath, n.AuthorizationNumber order by n.EventCreationDateTime desc
match (n:HealthcareServiceRequest) where n.AuthorizationNumber in ['2208390000']
and n.AuthRequestType = '005010X217' and n.EventName = 'Response278'
return n.TransactionID, n.AuthorizationNumber order by n.EventCreationDateTime desc
04-27-2022 08:41 AM
The second query is searching for the same HealthcareServiceRequest entity as the first query, but the return items are not the same. Adding the transactId to return statement of the first query doesn’t get you what you want?
Is it the case that there is not always a Attachments275 entity in the first query, so you don’t get results? If so, switch the match on the attachment275 to an optional match.
04-27-2022 08:54 AM
I am sorry i didnt get it
How should the query will be
I did some research and get that one
match (n:HealthcareServiceRequest) where n.AuthorizationNumber in %s
and n.AuthRequestType = '005010X217' and n.EventName = 'Response278'
Match (m:Attachments275) where n.AttachControlNumber = m.AttachmentControlNumber
return n.AuthorizationNumber as Authorization_ID, n.TransactionID as TransactionID, m.Attachmentpath as Attachmentpath order by n.EventCreationDateTime desc
Is that correct ???
04-27-2022 09:13 AM
What about the query does not work?
I was suggesting the following to address the situation where there is not an associated attachment, but you still want a result.
match (n:HealthcareServiceRequest) where n.AuthorizationNumber in %s
and n.AuthRequestType = '005010X217' and n.EventName = 'Response278'
Optional Match (m:Attachments275) where n.AttachControlNumber = m.AttachmentControlNumber
return n.AuthorizationNumber as Authorization_ID, n.TransactionID as TransactionID, m.Attachmentpath as Attachmentpath order by n.EventCreationDateTime desc
04-27-2022 09:17 AM
When i run the query I executed i got duplicated results like that pic
And i need to get only one record not multiple
04-27-2022 09:29 AM
You must have multiple Attachment275 nodes that meet the requirement.
Change the query's return to below, so we can see if there are multiple Attachment275 nodes:
return id(n), id(m)
What do you get?
04-27-2022 09:37 AM
Can you give me the full query you want me to try it please ?
I am sorry i didn't work on it before
04-27-2022 09:39 AM
sure:
match (n:HealthcareServiceRequest) where n.AuthorizationNumber in ['2207090003']
and n.AuthRequestType = '005010X217' and n.EventName = 'Response278'
Match (m:Attachments275) where n.AttachControlNumber = m.AttachmentControlNumber
return id(n), id(m)
04-27-2022 09:40 AM
I am getting this result
04-27-2022 09:44 AM
Just what I thought. You have multiple Attachment275 nodes that meet the requirement. The results look like duplicates because the fields you are returning for the Attachment275 nodes have the same values. In reality, they are different nodes. id(m) is the internal neo4j id for the Attachment275 nodes returned. The values are all different, thus they are different nodes.
Do you expect this, or have these nodes been unintentionally duplicated? Are all the properties for these nodes identical?
04-27-2022 09:50 AM
Run this query if you want to compare the Attachment275 nodes:
match (n:HealthcareServiceRequest) where n.AuthorizationNumber in ['2207090003']
and n.AuthRequestType = '005010X217' and n.EventName = 'Response278'
Match (m:Attachments275) where n.AttachControlNumber = m.AttachmentControlNumber
return id(n), id(m), properties(m)
All the sessions of the conference are now available online