Boolean function difficulty with Export format

I am trying to export tag data to a file (TSV/CSV). I want to add two columns to indicate the external source of the music. One column would contain ‘CD’ or nothing, the other ‘Download’ or nothing. I am trying to use $if(x,y,z) to distinguish the source. After using $strstr to scan %filepath to locate my text indicator. No matter what I specify for x, the z value (false) is substituted. Ex: $if(1,true,false) I can’t find a x that will substitute ‘true’.

Are there any suggestions how to specify a ‘False’ boolean?

Thanks.

You have to add a comparison operator like $eql or $grtr, e.g
$if($grtr($strstr(%_filepath%,CD),0),CD,)

Thanks very much for the fix. It works somewhat. I may be misunderstanding.

I have four sources that I want to identify: CD, Download, Misc, and/or Temp. It seems like once the $grtr 0 is true (string found) subsequent uses of $strstr return a location > 0 when the target string (y) is actually not in the string (x).

This is the complete format string which includes the &strstr x %_folderpath% value for debugging aid:

$char(9)%composer%$char(9)%Title%$char(9)%album%$char(9)%local-work%$char(9)%localother%

$char(9)$if($grtr($strstr(%_folderpath%,CDs),0),CD,not)

$char(9)$if($grtr($strstr(%_folderpath%,Downloads),0,),DL,not)

$char(9)$if($grtr($strstr(%_folderpath%,Misc.),0,),Misc,not)

$char(9)$if($grtr($strstr(%_folderpath%,Temp),0,),Temp,not),

$char(9)%_folderpath%

This is the formatted export (I don’t know how to make it legible/larger here).

I would appreciate any further light you can shed on this.

Thanks,

Art

AFAI can see it, you get a "not" each time the string is not found - which is probably the case 3 out of 4 times.

It would be better to cut the location word from the %_directory% and then replace it with the desired string, e.g.
$replace($regexp(%_directory%,.* - (.*),$1),CDs,CD,Downloads,DL,Misc.,Misc,Temp,Temp)

Hi again and thank you for the new suggestion. I did not understand exactly what the output was going to be and based on past experience, I didn’t want to be further confused by regular expressions so I held off working with it.

But I was successful when I changed from using $grtr and comparing the string position with zero.

I used $eql and compare the string position with the fixed location of the target characters in the path. Kind of what I think you were getting at with cut and replacement. It seems to give me what I wanted.

I appreciate your help. Thanks again.

Art