Split multi-valued cells

8 views
Skip to first unread message

Parthasarathi Mukhopadhyay

unread,
Apr 2, 2021, 12:53:42 AM4/2/21
to openr...@googlegroups.com
Dear all

The resulting column for fetching a JSON data source is like this:

[{"id":"45858","publisher":"Elsevier","issn":null,"journal":"Chemical Physics Letters","role":"Advisory Editorial Board","editor":"Dr. A. Ganguli","affiliation":"Indian Institute of Technology Delhi, Department of Chemistry, Delhi, Delhi, India","url":"https:\/\/www.journals.elsevier.com\/chemical-physics-letters\/editorial-board","date":"2020-12-15"},{"id":"339822","publisher":"MDPI","issn":"2311-5521","journal":"Fluids","role":"Editorial Board Members","editor":"Prof. Dr. Srinivas V. Veeravalli","affiliation":"Department of Applied Mechanics, Indian Institute of Technology Delhi, Hauz Khas, New Delhi, Delhi 110016, India","url":"https:\/\/www.mdpi.com\/journal\/fluids\/editors","date":"2020-12-17"},{"id":"415650","publisher":"SAGE","issn":"0975-4253","journal":"Environment and Urbanization ASIA","role":"Editorial Board","editor":"Shreekant Gupta","affiliation":"Professor, Department of Economics, Delhi School of Economics, University of Delhi, New Delhi, India","url":"https:\/\/journals.sagepub.com\/editorial-board\/euaa","date":"2020-12-14"},{"id":"418539","publisher":"SAGE","issn":"0015-7325","journal":"Foreign Trade Review","role":"Editorial Advisors","editor":"Partho Sen","affiliation":"Former Professor, Delhi School of Economics, University of Delhi, Delhi, India","url":"https:\/\/journals.sagepub.com\/editorial-board\/ftra","date":"2020-12-14"},{"id":"420610","publisher":"SAGE","issn":"2230-8075","journal":"History and Sociology of South Asia","role":"Editorial Advisory Board","editor":"Pulin B Nayak","affiliation":"Department of Economics, Delhi School of Economics, University of Delhi, Delhi, India","url":"https:\/\/journals.sagepub.com\/editorial-board\/hsab","date":"2020-12-14"}]

I want to extract the affiliation element from there and a typical forEach() is not working (reporting error as the affiliation element here is not represented as an array).

However, the GREL  >> if(value.startsWith("["),forEach(value.parseJson(),v,v.affiliation).join("++"),value.parseJson().affiliation) is giving me results like this (by following this thread - https://stackoverflow.com/questions/41502023/parse-multivalued-json-in-grel-openrefine) :

Indian Institute of Technology Delhi, Department of Chemistry, Delhi, Delhi, India++Department of Applied Mechanics, Indian Institute of Technology Delhi, Hauz Khas, New Delhi, Delhi 110016, India++Professor, Department of Economics, Delhi School of Economics, University of Delhi, New Delhi, India++Former Professor, Delhi School of Economics, University of Delhi, Delhi, India

But when I try to split the resulting multi-valued cells, only the first item is coming but not the others.

The split multi-valued cells option is just working fine for my other projects but not here.

What went wrong?

Regards


-----------------------------------------------------------------------
Parthasarathi Mukhopadhyay
Professor, Department of Library and Information Science,
University of Kalyani, Kalyani - 741 235 (WB), India
-----------------------------------------------------------------------

Parthasarathi Mukhopadhyay

unread,
Apr 2, 2021, 3:06:34 AM4/2/21
to openr...@googlegroups.com
Sorry friends. It was my fault. Actually, I forgot to switch over to rows view from record view :-(

Best regards


Reply all
Reply to author
Forward
0 new messages