Your subscription could not be saved. Please try again.
Your subscription has been successful.

Subscribe to receive our monthly OpenRefine roundups with new tutorials, release updates and community announcements.

18.10.11

Starts or ends with a number

This is a quick and dirty tips to facet cells starting or ending with a number. Regex will be much cleaner for this but unfortunately the grel expression startsWith and endsWith does not support regex :-(




So select your column and facet and Custom text facet ....

If you want to filter all cells starting with a number use the following expression:

if(startsWith(value,'0'), 'true', if(startsWith(value,'1'), 'true',if(startsWith(value,'2'), 'true',if(startsWith(value,'3'), 'true',if(startsWith(value,'4'), 'true',if(startsWith(value,'5'), 'true',if(startsWith(value,'6'), 'true',if(startsWith(value,'7'), 'true',if(startsWith(value,'8'), 'true',if(startsWith(value,'9'), 'true', 'false'))))))))))

If you want to filter all cells ending with a number use the following expression:

if(endsWith(value,'0'), 'true', if(endsWith(value,'1'), 'true',if(endsWith(value,'2'), 'true',if(endsWith(value,'3'), 'true',if(endsWith(value,'4'), 'true',if(endsWith(value,'5'), 'true',if(endsWith(value,'6'), 'true',if(endsWith(value,'7'), 'true',if(endsWith(value,'8'), 'true',if(endsWith(value,'9'), 'true', 'false'))))))))))


This post was

0 comments:

Post a Comment