Skip to Content
It is currently March 5th, 2021, 1:47 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: August 29th, 2020, 10:42 pm 
Offline
Senior User
Senior User

Joined: July 23rd, 2007, 2:22 am
Posts: 141
What is the correct operand for a PAL script to ignore anything with the word "Christmas" in the song title or album title?

I tried:

Code:
'AND title <> ''Christmas'' '+
'AND album <> ''Christmas'' '+

But that didn't work. I also tried it with != and although the script processed with no errors, that didn't work either.

There are a lot of Christmas tracks on my station but it's a bit too early to be playing Christmas music.

I also looked on the PAL Getting Started website and that wasn't much help.

Thanks.

_________________
Park Magic Radio
http://parkmagicradio.ca


Top
 Profile  
Reply with quote  
PostPosted: August 30th, 2020, 7:36 am 
Offline
Senior User
Senior User

Joined: June 1st, 2005, 11:46 pm
Posts: 120
Location: Cosmopolis, Washington
!=

_________________
https://deadtoselfradio.com


Top
 Profile  
Reply with quote  
PostPosted: August 30th, 2020, 7:52 am 
Offline
SVS Member
SVS Member

Joined: May 8th, 2004, 9:00 am
Posts: 10526
Location: Denver, CO
Is the genre Christmas? I would check for tracks not equal using genre not title or album. However in your example above would only work if Christmas was the only word in the title or album. It requires a wildcard leading and trailing your query.

_________________
- Rob Oyler, SVS
Image


Top
 Profile  
Reply with quote  
PostPosted: August 30th, 2020, 9:24 am 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 8156
Location: Cologne (Germany)
You're mixing up SQL and PAL.
PAL = only the stuff outside of quotes
SQL = the language in which you write commands directly to the database, like when using the Query or ExecSQL commands.

Also: What you wrote there is perfectly fine if your goal was to say "give me all tracks where neither the album name nor the track title is exactly 'christmas'"
i.e.: Christmas Wonderland !=/<> Christmas => will still be returned.

What you're looking for is a LIKE expression:
Code:
SELECT * FROM songlist WHERE NOT title LIKE '%christmas%' AND NOT album ILIKE '%christmas%';


Notes:
LIKE = regular expressions in MySQL, you can use wildcards or specific grouping expressions. Here I only used the wildcard symbol in front and back of the word christmas to say match the word christmas preceded by anything (including nothing/at the very beginning) and followed by anything (including nothing/at the very end)

% = Wildcard symbol for zero or more characters. You're not limited to the first and last position with this. You could also write '%n40' to match your username dan40 or 'dan%0' to match any dan50 or dana0. You can also use more than one of these.

Attn: For MySQL Like is case insensitive, it will match Christmas, CHRISTMAS, christmas etc., but this isn't the same in all SQL dialects, Postgres for example is case sensitive by default and has a special ILIKE operator. No idea about MS SQL or Firebird, though. I don't work with either of these on my job and have almost no experience with them in SAM.

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

Shop for readymade PAL scripts by countrywesterndj - Or get a custom script made by me (or others)

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
PostPosted: August 30th, 2020, 9:27 am 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 8156
Location: Cologne (Germany)
jtthomas wrote:
!=

That works for SQL, but doesn't work in PAL.
PAL is a modified version of Delphi and in that family of programming languages the negation operator is just "NOT" and not "!", but it also can't be combined with a comparison operator.

So "Not equals" in Delphi/Pascal/PAL is "<>" or "either less than or greater than". It's confusing if you're not familiar with that family of languages.

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

Shop for readymade PAL scripts by countrywesterndj - Or get a custom script made by me (or others)

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
PostPosted: August 30th, 2020, 12:49 pm 
Offline
Senior User
Senior User

Joined: July 23rd, 2007, 2:22 am
Posts: 141
Great help! Thank you all for responding so quickly. I ended up using this query in my PAL script:
Code:
'AND NOT title LIKE ''%christmas%'' AND NOT album LIKE ''%christmas%'' '+

There isn't any syntax error in my query, and I've been watching it for several minutes now and so far it hasn't given me any Christmas tracks.

You don't know how much I value all the expert advice here. Truly commendable.

Dan

_________________
Park Magic Radio
http://parkmagicradio.ca


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 24 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group