New Members: Be sure to confirm your email address by clicking on the link that was sent to your email inbox. You will not be able to post messages until you click that link.

How do I write a scan that excludes any blanks in the Sector field?

I want to run a scan that only gives me results if there is an entry (of any kind) in the Sector field, without having to add every possible Sector. How would I create a scan that would be something like:

Group is not 'blank', or Group != "" (neither of those work, btw)

basically, is there a parameter for a blank or null field?


  • markdmarkd mod
    edited July 2019
    As far as I know, you cannot test for a null or blank value - at least it didn't work when I've tried it either, although that was a while ago, so it may have changed. But here is the code for "any sector", adapted from an old scan of mine:


    [ // sectors open bracket

    [group is EnergySector]
    or [group is MaterialsSector]
    or [group is IndustrialSector]
    or [group is CyclicalsSector]
    or [group is ConsumerStaplesSector]
    or [group is HealthCareSector]
    or [group is FinancialSector]
    or [group is TechnologySector]
    or [group is CommunicationServicesSector]
    or [group is UtilitiesSector]
    or [group is RealEstateSector]
    ] // sectors close bracket

    "CyclicalsSector" still works, but "ConsumerDiscretionarySector" may also work.

  • lmkwinlmkwin ✭✭
    I haven't been able to decipher the null or blank option either. The field properties would infer a text field so perhaps the scan engine makes the filter field type match the data field type. That's probably why it converts whatever you type into a quote.

    I've tried as well as the null, blank, etc. Maybe it's spaces but it's probably 200 spaces or something longer than necessary.
  • @markd thanks for the help. I actually wrote that scan as well, but was a little mystified on why ConsumerDiscretionarySector was not available... wtf?

    Looks like I'll have to do it the hard way... thanks StockCharts...
  • It seems like the programmers have a little housework to do in cleaning up their tables. It may be that someone - probably NOT the programmers - at some point decided "Cyclicals" was a better term for the sector, and then someone decided, no, let's go back to "Consumer Discretionary". Or, it could have been a data vendor decision. In any case, somebody needs to synchronize the data labels and the scan engine labels. Maybe there is already a ticket but it's low priority?
Sign In or Register to comment.