Case in-sensitive string comparisons


#1

Hi,

As per the documentation (https://dnif.it/docs/learn/DQL/field.html ) … I am trying to explore switch_case function for switching the CASE of my field data … however it seems to be designed for the purpose of altering the content. Well my aim is to perform Case In-sensitive str_compare so as to get precise results across wider data sets.
for example - please consider the following snippet

_fetch * from event where $LogType=X AND $LogType=Y AND $Duration=1d group count_unique $ScopeID, $Field1 limit 100

_checkif lookup temp_profile join $ScopeID = $ScopeID str_compare $Field1 eq $TempField include

Here I want to get $Field1 to be compared to $TempField : irrespective of the “CASE”
Hence the outcome would be based on A = a

I am not sure if RegEx can be used for dynamic values. Hence I am looking for something like the following –

_fetch * from event where $LogType=X AND $LogType=Y AND $Duration=1d group count_unique $ScopeID, $Field1 limit 100

_checkif lookup temp_profile join $ScopeID = $ScopeID str_compare_nocase $Field1 eq $TempField include

:slight_smile:

Looking forward for expert opinion from @DNIF Team.

Thanks
Vaibhav


#2

Hi Vaibhav,

You can use substr function to achieve the same as it checks case insensitive data.
Please refer the query below.

_checkif lookup temp_profile join $ScopeID = $ScopeID str_compare $Field1 substr $TempField include

Please refer the link below.

Thank you,
Ravidutt Purwal.