Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Hi Team,
I have a dataset which one column consisting of multiple values, for example
Column1
Metric1,Country
METRIC1,Country
METRIC1,Country
Metric2,Country
Is there a work around to filter the values in the column to only keep the value that contains 'Metric1' regardless of the case.
The result should be:
Column1
Metric1,Country
METRIC1,Country
METRIC1,Country
I tried the below query but it does not work.
( contains(toLowercase(val('Column1')), toLowercase(val('METRIC1'))) )
Please assist.
Hello, I think you have an extra "val" in your formula. Can you please try:
contains(toLowercase(val('Column1')), 'metric1')
Hi,
In a Prepare recipe you can use the "Extract with Regular Expression" processor, which will allow you to identify the rows that contain Metric1 in either lowercase or uppercase.
https://doc.dataiku.com/dss/latest/preparation/processors/pattern-extract.html
To help you with the regex expression, use the smart pattern builder and select the right values
I hope this helps.
Best regards
Hello, I think you have an extra "val" in your formula. Can you please try:
contains(toLowercase(val('Column1')), 'metric1')
Hi MarcH,
This solution works for me ! Thanks! Additionally can you help to elaborate further what does the val() function really represents here? Cause if i tried to remove the val() function, it does not work.
contains(toLowercase(val('Column1')), 'metric1')
Hello, good to hear! The val() function returns the value of the column whose name you give as an argument (the column named 'Column1' in your example). If you just put 'Column1' without the val(), you'll just get a String that always has a value of 'Column1', like was done for 'metric1' in your example.